Can't connect to Remote MySQL Server (10061)

To allow remote access to MySQL, you have to comment out bind-address (you did) and skip-networking in the configuration file.

Next, you have to make sure the user is allowed remote access. Check your user with this:

SELECT User, Host FROM mysql.user;

If your user here has '127.0.0.1' or 'localhost' listed as host, you don't have remote access.

Change this with:

UPDATE mysql.user SET HOST='%' WHERE User='__here_your_username';

Flush privileges:

FLUSH PRIVILEGES;

The '%' is a wildcard for 'all hosts'.


To Allow remote access to MySQL installed on a Ubuntu, you will have to access the file at this location:

/etc/mysql/mysql.conf.d/mysqld.cnf

There, you comment out the following line: bind-address = 127.0.0.1

basically to change: bind-address = 127.0.0.1 to: #bind-address = 127.0.0.1

Now you either restart the computer or just the mySQL service using the follwing command: sudo /etc/init.d/mysql restart


In my case, installed LAMP stack on Oracle VM of Ubuntu 18.04

Here's my updateto mysql config file: /etc/mysql/mysql.conf.d/mysqld.cnf

Before:

bind-address          = 127.0.0.1

After:

# bind-address          = 127.0.0.1
# comment out bind-address to test remote access

Ensure your user can access from remote host sudo mysql -u root -p Enter your password, then issue the command

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;

+------------------+-------------------------------------------+-----------------------+--------------+ | user | authentication_string | plugin | host | +------------------+-------------------------------------------+-----------------------+--------------+

| newuser | *9ACA980716AE084BCA56C59D19F3CEB7BB87B139 | mysql_native_password | 192.168.x.x | | newuser | *9ACA980716AE084BCA56C59D19F3CEB7BB87B139 | mysql_native_password | localhost |

This works for me, good luck.

Tags:

Mysql

Ubuntu