Home  >  Article  >  Operation and Maintenance  >  Detailed explanation on Linux system authorization for MySQL external network access

Detailed explanation on Linux system authorization for MySQL external network access

黄舟
黄舟Original
2017-05-31 11:26:492303browse

Problem phenomenon


MySQL Unable to connect through the external network.

Cause of the problem


Execute in the bin directory of MySQL:

Log in to the data

mysql -uroot -p密码
use mysql;
select host,user,password from user;

You can see If user is root and host is localhost, it means that MySQL only allows local connection, so external network and local software clients cannot connect.

Solution


Execute the following command:

update user set host='%' where user ='root';
flush privileges;

Check whether the modification is normal:

For the method of setting up remote connections for other users:

GRANT ALL PRIVILEGES ON 数据库名.* TO 账户@"%" IDENTIFIED BY "密码";
flush privileges;

You can test the external network connection to the MySQL server.

The above is the detailed content of Detailed explanation on Linux system authorization for MySQL external network access. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn