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

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

黄舟
黄舟Original
2017-07-27 15:42:391738browse

---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;

Method 2:

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

---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!

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