Mysql method to set remote access password: first log in to mysql and query the user table and host permission commands; then delete the root remote access user and update the permission commands; finally re-create the remote operation account for remote access authorization and update permissions.
Related free learning recommendations:mysql video tutorial
mysql settings remote Access password method:
1. Log in to mysql command:mysql -uroot -p
(Enter the password and enter the password)
2. Query the user table and host Permission command:
use mysql select user, host from mysql.user;
Note: The % here represents that any machine can remotely connect to the server through root. We can directly delete this user and redefine the user and password.
3. Delete the remote access user root,
delete from mysql.user where user = 'root' and host = '%';
4. Update permission command:
flush privileges;
5. Query the user table again The host permissions are as follows:
6. Re-create the remote operation account, authorize remote access and update permissions, and execute the following code in sequence:
create user 'root'@'%' identified with mysql_native_password by '123456'; grant all privileges on *.* to 'root'@'%' with grant option; flush privileges;
The above is the detailed content of How to set remote access password in mysql. For more information, please follow other related articles on the PHP Chinese website!