MYSQ Remote Connection

Source: Internet
Author: User

MySQL will use this computer to connect to the MySQL service on the remote server during the development phase. But will be blocked. We just have to go to the MySQL server to open MySQL locally, find the user table inside a users, modify the host is%, can. Restarting the MySQL server after the operation has completed will take effect. The remote service can then be accessed locally.

However, if the MySQL service is officially on-line, you need to create a new user, and then set her permissions, so that the relative security,

1, create user law (use when project is on line)

SQLyog client, with the root user remote link MySQL, the prompt "Access is denied", searched the internet for a reason.

The original is MySQL does not authorize its remote link, so you can only link in the client.

How to solve it?

Original table Data

mysql> use MySQL

Mysql> select Host,user,password from User;
+---------------+---------+-------------------------------------------+
| Host | User | Password |
+---------------+---------+-------------------------------------------+
| localhost | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| www | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| 127.0.0.1 | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| :: 1 | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |

Create a new user

Format: Grant permission on the database name. Table name to user @ Login host identified by "User password";

Grant Select,update,insert,delete on * * to [e-mail protected] identified by "komiles1234";

After executing the above statement, execute the

Mysql> select Host,user,password from User;
+---------------+---------+-------------------------------------------+
| Host | User | Password |
+---------------+---------+-------------------------------------------+
| localhost | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| www | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| 127.0.0.1 | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| :: 1 | Root | *dea65abecc50a1febd9c0d0d9045e0ddb312f38f |
| 123.4.56.89 | Komiles | *50663f1eceab844897bc272ec1ae7e83f442f649 |
+---------------+---------+-------------------------------------------+

At this point, you can use the user you just created for remote access.

The following is reproduced http://www.cnblogs.com/smallstone/archive/2010/04/29/1723838.html

Example:

Log in:

To test the connection:

2. Remote connection (authorization method-generally used in development time)

Changing the value of the host field to% means that you can log on to the MySQL server as the root user on any client machine, and it is recommended that you set it to% at development time.
Update user Set host = '% ' where user = ' root ';

Change permissions to all privileges


mysql> use MySQL;
Database changed
Mysql> Grant all privileges on * * to root@ '% ' identified by "root";
Query OK, 0 rows Affected (0.00 sec)

Mysql> select Host,user,password from user;
+--------------+------+-------------------------------------------+
| Host | user | password |
+--------------+------+-------------------------------------------+
| localhost | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |
| 192.168.1.12 | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |
| %            | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |
+--------------+------+-------------------------------------------+
3 Rows in Set (0.00 sec)

This allows the machine to remotely access MySQL on the machine with the user name root password root.

3, the realization of remote connection (change the table method)

Use MySQL;

Update user Set host = '% ' where user = ' root ';

This allows the root user to access MySQL at the remote end.

SQLyog client cannot connect to MySQL server case analysis http://www.linuxidc.com/Linux/2014-09/106884.htm

CentOS 6.3 Install MySQL with SQLyog connection http://www.linuxidc.com/Linux/2012-11/74401.htm

Install MySQL http://www.linuxidc.com/Linux/2014-05/102366.htm under Ubuntu 14.04

"MySQL authoritative guide (original book 2nd edition)" Clear Chinese scanning version PDF http://www.linuxidc.com/Linux/2014-03/98821.htm

Ubuntu 14.04 LTS installation lnmp nginx\php5 (PHP-FPM) \mysql http://www.linuxidc.com/Linux/2014-05/102351.htm

This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-09/106892.htm

MYSQ Remote Connection

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.