How to set mysql to allow external network access_PHP tutorial

WBOY
Release: 2016-07-21 15:09:04
Original
1074 people have browsed it

For the root account of mysql, I usually use localhost or 127.0.0.1 when connecting. Mysql on the company’s test server is also localhost, so I cannot access it and the test is suspended.

Solution:

1. Modify the table, log in to the mysql database, switch to the mysql database, and use the sql statement to view "select host, user from user;"

mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = '%' where user ='root';
mysql>select host, user from user;
mysql> flush privileges;

Note: The last sentence is very important, the purpose is to make the modification effective. If it is not written, remote connection will still not be possible.

2, authorized user, you want to use root password to connect to the mysql server from any host

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'admin123' WITH GRANT OPTION;
flush privileges;

If you want to allow user root to connect to the mysql server from the host with ip 192.168.1.104

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.104' IDENTIFIED BY 'admin123' WITH GRANT OPTION;
flush privileges;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327366.htmlTechArticlemysql root account, I usually use localhost or 127.0.0.1 when connecting, on the company's test server Mysql is also localhost, so I want to access it and cannot access it, and the test is suspended. Solution:...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!