Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't connect to Remote MySQL Server (10061)

Tags:

mysql

ubuntu

Localhost connection is enabled in MySQL.

But Remote(My laptop) access is disabled

Can't connect to MySQL server on "host" (10061)`.

My port always open 3306.

Here is my config file (/etc/mysql/my.cnf) :

#bind-address 0.0.0.0
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

And MySQL status is :

mysql start/running, process 15204
like image 530
Hax0r Avatar asked Jun 20 '16 07:06

Hax0r


People also ask

Can not connect to MySQL server 10060?

The error 10060 is returned by the MySQL client when a connection could not be established with the service on the system you are connecting to. This is commonly caused by a firewall block or network issue preventing the connection.


2 Answers

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'.

like image 117
Keugels Avatar answered Oct 11 '22 10:10

Keugels


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

like image 29
Nesan Mano Avatar answered Oct 11 '22 11:10

Nesan Mano