Ubuntu14.04 install MySQL cannot connect

1. Modify the configuration file: sudo gedit /etc/mysql/my.cnf
Find the bind-address and modify bind-address=127.0.0.1 to bind-address = 0.0.0.0 to allow any IP to access the MySQL service.


2. Restart the MySQL service: sudo /etc/init.d/mysql restart


3. Log in to the MySQL database and authorize users who need remote access:
mysql> grant all privileges on test.* to root@"%" identified by "root" with grant option;
This time, the root user is authorized to remotely access the test database. If you want to authorize all databases, use * instead of test to indicate all databases.


4. Refresh the configuration to make the permissions take effect immediately:
mysql> flush privileges;


At this point, you can log in normally through the MySQL client of the physical host.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325179477&siteId=291194637