Navicat for MySQL remote connection MySQL database 10061, 1045 error

Source: Internet
Author: User

The easiest way to do this is

MySQL Remote configuration

The code is as follows Copy Code


GRANT all privileges on *.* to root@ '% ' identified by ' your Paaaword '; % indicates that there are more machines.

Open Port 3306, set the exception for the firewall, and release 3306.

But you have to have root privileges.

You can also modify the following methods:

1: Locate the My.ini file under the server MySQL folder. Modify bind-address=127.0.0.1 to bind-address=0.0.0.0 (not found in MySQL 5 my.ini)

2: Restart the MySQL service.

To test connection conditions:

If you do not add permissions that all machines can access to Telnet users, the 1045-access denied for user root@it (using Password:no) appears, indicating that you need to add permissions;

Add commands as follows:

The code is as follows Copy Code

1 Grant all on *.* to user name @ "%" identified by "password";

2) flush privileges;

By completing these steps, you can remotely access the MySQL database.


If the above method doesn't work out, we can open MySQL. Remote access permission allows remote connections

1, login MySQL Database

The code is as follows Copy Code

Mysql-u root-p

View User table

The code is as follows Copy Code
mysql> use MySQL;
Database changed
Mysql> select Host,user,password from user;
+--------------+------+-------------------------------------------+
| Host | user | password |
+--------------+------+-------------------------------------------+
| localhost | Root | *a731aebfb621e354cd41baf207d884a609e81f5e |
| 192.168.1.1 | Root | *a731aebfb621e354cd41baf207d884a609e81f5e |
+--------------+------+-------------------------------------------+
2 rows in Set (0.00 sec)

You can see the root user that has been created in the user table. The Host field indicates which hosts are logged on, their values can be IP, and host names are available.

(1) Sometimes want to use the local IP login, then you can change the host value of the above to their own IP can.

2. Realize remote connection (authorization law)

Changing the value of the host field to% indicates that the root user can log on to the MySQL server 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

The code is as follows Copy Code

mysql> use MySQL;
Database changed
Mysql> grant all privileges in *.* 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 | *a731aebfb621e354cd41baf207d884a609e81f5e |
| 192.168.1.1 | Root | *a731aebfb621e354cd41baf207d884a609e81f5e |
| %            | Root | *a731aebfb621e354cd41baf207d884a609e81f5e |
+--------------+------+-------------------------------------------+
3 Rows in Set (0.00 sec)

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

3. Realize remote connection (change table method)

The code is as follows Copy Code

Use MySQL;

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

This allows MySQL to be accessed remotely from the root user

Related Article

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.