I have a VM (Ubuntu 18.04 Server) and mysql installed on it and running on port 3306. I think it's quite essential to show the whole config, here it is:
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
server-id = 1
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
log-bin = /var/log/mysql/mysql-bin.log
socket = /var/run/mysqld/mysqld.sock
sync_binlog = 1
binlog_format = ROW
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 192.168.1.91
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
log_error = /var/log/mysql/error.log
expire_logs_days = 7
max_binlog_size = 500M
The address of the virtual machine is 192.168.1.91. The address of the hostmachine is 192.168.1.118. I ssh to the virtual machine and issue the following command:
sudo mysql -u root -p
Then I issue a series of commands shown here in the first section. It creates a new admin-like user with all the privileges necessary.
Now I quit and try to log in like so from the vm:
sudo mysql -u vScopeUserName -h 192.168.1.91 -p
It works.
If I try to log in like so from the vm:
sudo mysql -u vScopeUserName -h localhost -p
It works.
Now if I try to log in like so from the host machine (whose ip is 192.168.1.118):
sudo mysql -u vScopeUserName -h 192.168.1.91 -p
It errors out with:
ERROR 1130 (HY000): Host '192.168.1.118' is not allowed to connect to this MySQL server
I would be extremely grateful if you would help me figure out the reason behind this error. What am I doing wrong?! I've googled through a bunch of stuff on the internet and but all I tried did not work, I'm still getting the same error.