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.
##2. After entering a mysql database, execute use nysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
4. After the execution is completed, you need to enter flush privileges; it will take effect immediately
##5. Then check whether the modification is successful, enter select host, user from user; then
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!