Mysql remote connection problems

Source: Internet
Author: User
Database.51cto.comart201274565.htm When remotely connecting to the MySQL database, CantconnecttoMySQLserver (10060) is displayed. We can start from the following aspects to find out the cause of the error: 1. network failure. Check whether the ping is successful. 2. Firewall settings. Does the firewall miss the mysql process?

Http://database.51cto.com/art/201107/274565.htm when the remote connection to MySQL database showed Can't connect to MySQL server (10060), we start from the following aspects, find out the cause of the error: 1. network failure. Check whether the ping is successful. 2. Firewall settings. Does the firewall miss the mysql process?

Http://database.51cto.com/art/201107/274565.htm

When you remotely connect to the MySQL database, You Can't connect to MySQL server (10060). We Can start from the following aspects to find out the cause of the error:

1. The network is disconnected.

Check whether the ping is successful.

2. Firewall settings.

Whether the firewall has spared the mysql process and blocked port 3306 of mysql.

3. mysql account settings.

Whether the mysql account cannot be remotely connected. If the connection fails, try the following methods:

 
  1. Mysql-u root-p // log on to MySQL
  2. Mysql> grant all privileges on *. * TO 'root' @ '%' with grant option; // any remote host can access the database.
  3. Mysql> flush privileges; // you need to enter the command to make the modification take effect.
  4. Mysql> EXIT // EXIT

You can also modify the table to remotely:

 
  1. mysql -u root -p
  2. mysql> use mysql;
  3. mysql> update user set host = '%' where user = 'root';
  4. mysql> select host, user from user;
Http://blog.sina.com.cn/s/blog_544f18310100ykh2.html
GRANT ALL PRIVILEGES

I. Change the table. It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to mysql on the computer of localhost, and change the "host" entry in the "user" table in the "mysql" database to "%" from "localhost"

1. mysql-u root-pvmwaremysql> use mysql;
2. mysql> update user set host = '%' where user = 'root ';
3. mysql> select host, user from user;


Ii. Authorization law.

For example, if you want myuser to use mypassword to connect to the mysql server from any host.
1. grant all privileges on *. * TO 'myuser' @ '% 'identified BY 'mypassword' with grant option;

2. flush privileges;


If you want to allow myuser to connect to the mysql server from a host whose ip address is 192.168.1.6, and use mypassword as the password
1. grant all privileges on *. * TO 'myuser' @ '192. 168.1.3 'identified BY 'mypassword' with grant option;
2. flush privileges;

Another method.
Run the following command on the machine where mysql is installed:
1. d: \ mysql \ bin \> mysql-h localhost-u root
// You can access the MySQL server.
2. mysql> grant all privileges on *. * TO 'root' @ '%' WITH GRANT OPTION
// Grant data access permissions to any host
3. mysql> FLUSH PRIVILEGES
// The modification takes effect.
4. mysql> EXIT
// Exit the MySQL server
In this way, you can log on to any other host as the root user!


Ps: After mysql is installed, add the mysql root User password: mysql-u root password 'your _ password'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.