Home > Database > Mysql Tutorial > MySQL uses two methods to solve the problem of remote connection failure

MySQL uses two methods to solve the problem of remote connection failure

黄舟
Release: 2017-07-27 15:42:39
Original
1905 people have browsed it

---Start restoring content---

Mysql has two methods to solve the problem of remote access. Friends who need it can refer to it:

1. In /etc/ Comment out bind-address = 127.0.0.1
in the [mysqld] section of mysql/my.cnf. 2. Use mysql -uroot -p to log in to mysql, and then use the following method to enable remote access:


Method 1: mysql>use mysql;

mysql>update user set host = '%' where user = 'root';    
mysql>FLUSH RIVILEGES;
Copy after login

Method 2:

mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
Copy after login

---End of recovery content---

The above is the detailed content of MySQL uses two methods to solve the problem of remote connection failure. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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