Solving: Can’t connect to MySQL server on ‘IP Adress’ (10061)

MySQL remote connection error

If you are having this problem, it means that your MySQL server is now allowing remote connections.

To solve this, you must follow the next steps:

1. Login into your machine via SSH with a ROOT user.
2. Connect to your MySQL server:

mysql --host=localhost --user=myname --password=mypass

3. Execute next line on MySQL console with your username and password:

GRANT ALL PRIVILEGES ON *.* TO 'your_mysql_username'@'%' IDENTIFIED BY 'your_mysql_password' WITH GRANT OPTION;

4. Open MySQL folder:

cd /etc/mysql/

5. Change Bind Ip Adress on my.cnf file:

sudo nano my.cnf

6. Change the ip adress ‘127.0.0.1’ to your local machine IP adress:

Modifying MySQL server bin adress
 

7. Save file changes pressing Ctrl + O to save and Ctrl + X to exit from editor.
8. Now, restart your MySQL server and you should connect externally to it.

sudo service mysql restart

 

Alberto
A young developer from Madrid who loves programming and computing. Constantly testing with new technologies and thinking in new projects and challenges.