Home  >  Article  >  Database  >  How to set remote access password in mysql

How to set remote access password in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-11-13 09:35:353337browse

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.

How to set remote access password in mysql

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.

How to set remote access password in mysql

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:

How to set remote access password in mysql

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!

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