localhost mysql remote access permissions

First, configure the mysql command

 Add the mysql bin directory to the path environment variable Path, the machine is C: \ Program Files \ MySQL \ MySQL Server 5.7 \ bin

Second, the implementation in cmd.exe

1. Log in MySQL

mysql -uroot -proot

Enter your password

2. Select the mysql database

use mysql;

Because the mysql database user table stored in the user information.

3. Review the information about the current root user in the user table in the mysql database

1.select host, user, authentication_string, plugin from user; 
2.show variables like '%skip_networking%';

Displays a table after the completion of the implementation of the above command

View the table in the root user's host, the default localhost should be shown, only supports local access, remote access is not allowed.

All rights 4. Authorizes the root user and set up remote access

CREATE USER 'root'@'%' IDENTIFIED BY 'root';
 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

Set telnet

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

 

GRANT ALL ON represents all the rights, all the wildcard% said host, can be accessed remotely.

5. Refresh rights

After all operations should be executed

flush privileges;

6. Check the root user host

Again perform step 2, you'll find the root user host has become%, indicating that we have successfully modified, can be remotely accessed.

Third, remote database access

Use of the database visualization tools for remote access, such as Navicat, SQLyog, MySQL workbench, etc.

 

Click to view the database connection mysql user table to see the new host for the '%' of the root user.

Guess you like

Origin www.cnblogs.com/jet-angle/p/11906671.html