简体   繁体   中英

Can't connect remotely to MySQL Server with MySQL Workbench

Every time when I'm trying to connect remote mysql server through workbench. It gives me an error

can't connect mysql on remote server '10061'

But I am able to connect with phpmyadmin.

MySQL on default only listens to localhost as a security precaution. You might need to make sure MySQL is listening on your external IP interface: Follow the steps:

nano /etc/mysql/my.cnf

Edit the MySQL configuration file on your server and go to the following line:

bind-address = 127.0.0.1

The IP address 127.0.0.1 means your MySQL is only listening localhost. Change it to

bind-address = 0.0.0.0

Now MySQL will listen all IP Address.

  1. Add following lines to my.cnf in mysqld section

    bind-address = 0.0.0.0

  2. Restart mysql service

  3. Fire following query(on machine to which you want to connect)

i. create new user and password and grand privileges to that IP

GRANT ALL ON database_name.* TO u_name@'202.54.10.20' IDENTIFIED BY 'PASSWORD';

ii. To overwrite privilege

FLUSH PRIVILEGES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM