How to set remote access password in mysql

coldplay.xixi
Release: 2020-11-13 09:35:35
Original
3292 people have browsed it

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;
Copy after login

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 = '%';
Copy after login

4. Update permission command:

flush privileges;
Copy after login

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;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!