mysql open remote connection
Point of departure
Because the bridge project needs to use MySQL database, thinking that the MySQL of my laboratory server has been installed, I installed Navicat to prepare for remote connection, and connected through the shell to find that the operation was normal
mysql -u root -p
But an error occurred when using Navicat to connect, and the connection was refused, so I thought that MySQL might not allow remote login
Enable remote IP login permission
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Add bind-address = 127.0.0.1
before#
lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. # bind-address = 127.0.0.1
Then restart MySQL
/etc/init.d/mysql restart
Add user
After opening the remote login, a new error occurred: ...is not allowed to connect to this MySql server
So log in to MySQL through the shell, and execute the following commands in turn
use mysql;update user set host=’%’ where user=’root’;
Then the remote connection is successful
0 Comments