MySQL enables remote access to root

Procedural apes are fearless 2022-02-13 05:19:32 阅读数:483

mysql enables remote access root

mysql to root Turn on Remote Access

Original link :

MySql-Server For security reasons, only native computers are allowed by default (localhost, To connect to access . If it is not set to allow remote access, even if the account and password are all correct , You will also report mistakes. :

error no. 1045 access denied for user 'root'@'*****' (using password:YES).

We give root Increase permissions that can be accessed remotely

1. After connecting to the server , operation mysql System database

The order is :

mysql -u root -p
use mysql;

 Insert picture description here

Query user table command :

select User,authentication_string,Host from user

 Insert picture description here

It can also be seen here that host The default is localhost Access right
The next is the most important part :


there 123456 The password you set for the new permission user ,% On behalf of all hosts , It can also be specific to your host ip Address

2.flush privileges;

This step must be done , Otherwise it won't work ! This sentence means from mysql
Database grant Reload permission data in table
because MySQL Put the authority on cache in , So you need to reload... After making the changes .
After these two steps , Query the user table command again :

 select User,authentication_string,Host from user

 Insert picture description here

Found one more user , All hosts of the user can access , Now use again sqlyog Access connection succeeded !

copyright:author[Procedural apes are fearless],Please bring the original link to reprint, thank you.