Home  >  Article  >  Database  >  How to modify mysql login permissions

How to modify mysql login permissions

coldplay.xixi
coldplay.xixiOriginal
2020-10-21 16:46:134150browse

How to modify mysql login permissions: first log in to mysql; then modify the user table of the mysql library, change the host item from localhost to [%]; and finally change the corresponding ip.

How to modify mysql login permissions

How to modify mysql login permissions:

1. Log in to mysql

mysql -u root -p

2. Modify the user table of the mysql library and change the host item from localhost to %. %This means that any host is allowed to access. If only a certain IP is allowed to access, it can be changed to the corresponding IP. For example, localhost can be changed to 192.168.1.123, which means that only the IP 192.168.1.123 of the LAN is allowed to remotely access mysql. .

mysql> use mysql; 
mysql> update user set host = '%' where user = 'root'; 
mysql> select host, user from user; 
mysql> flush privileges;
防火墙开放3306端口

More related free learning recommendations: mysql tutorial(Video)

The above is the detailed content of How to modify mysql login permissions. 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