MySQL8.0 opens remote connection

1. To open a remote connection to MySQL, you need to log in to MySQL on the server first.

mysql -u root -p
1
然后 Enter password:

2. Modify the Host of the root account
1. Open the mysql database

use mysql;
1
2. View the current existing data in the user data table

select * from user \G;
1
3. Modify a piece of root data and refresh the MySQL system authority related table

update user set Host = '%' where Host = 'localhost' and User='root';
flush privileges;

 


Or use the grant command to recreate a user

grant all privileges on *.* to root @"%" identified by "root";
flush privileges;




3. Precautions
When the 10038 error occurs 2003 - Can't content to MySQL server on '127.0.0.1' (10038), you need to check the following points;
1. Remember to open the corresponding port in the server security group
2. Open the security group If you still can’t connect after that, you need to check the firewall. You can refer to the article: Centos 7 iptables open port
——————————————————
Copyright statement: This article is CSDN blogger "Flying-Blue Sky" The original article follows the CC 4.0 BY-SA copyright agreement. For reprinting, please attach the original source link and this statement.
Original link: https://blog.csdn.net/qw123456789e/article/details/126439867

Guess you like

Origin blog.csdn.net/qianjiu/article/details/129986574