How to enable MySQL database remote connection
Sometimes it is not possible to remotely connect to the MySQL database. You can refer to the following method to solve the problem.
1. log on to the MySQL database of your machine: mysql-uroot-p Password
Set the root user to access any IP address. The Code is as follows (optional, Here % represents any, you can also specify an IP address ):
MySQL> update user set host = '%' where user = 'root ';
MySQL> select host, user from user;
2. MySQL> grant all privileges on *. * TO 'root' @ '%' identified by 'mypassword' with grant option;
Grant data access permissions to any host
3. MySQL> flush privileges;
Modification takes effect
4. MySQL> EXIT
Log out of the MySQL server
In this way, you can log on to any other host as the root user!
Enter the IP address and port number on other machines (default port: 3306 ).
C: \ Users \ XXXXX> mysql-uroot-proot-h192.168.0.3-P3307
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 936
Server version: 5.5.28 MySQL Community Server (GPL)
Copyright (c) 2000,201 4, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql>
This article permanently updates the link address: