Home  >  Article  >  Database  >  How to set up remote connection to the database in MySQL?

How to set up remote connection to the database in MySQL?

黄舟
黄舟Original
2017-08-07 13:41:132647browse

In the default installation of mysql database, the remote client cannot connect to another database. If you need to connect to the database, you need to set up the mysql database before the remote client can connect to the database. .

1. After entering the Linux interface, you need to enter the database. Enter mysql -u root -p on the command line and press Enter to enter the password for the data.

How to set up remote connection to the database in MySQL?

##2. After entering a mysql database, execute use nysql

How to set up remote connection to the database in MySQL?


##3. Then enter in the command:

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

How to set up remote connection to the database in MySQL?4. After the execution is completed, you need to enter flush privileges; it will take effect immediately

How to set up remote connection to the database in MySQL?##5. Then check whether the modification is successful, enter select host, user from user; then

How to set up remote connection to the database in MySQL?6. If you still cannot connect Restart Linux.

The above is the detailed content of How to set up remote connection to the database in MySQL?. 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