Open the Linux terminal, enter the root authority, and open the MySQL configuration file with vim
vim /etc/mysql/mysql.conf.d/mysqld.cnf
Change the value of bind-address to 0.0.0.0
Enter MySQL
mysql -u root -p
Change the root user to allow remote login
update user set host = '%' where user = 'root';
create user
CREATE USER '用户名'@'%' IDENTIFIED BY '密码';
Grant remote access
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' WITH GRANT OPTION;
Refresh to take effect
FLUSH PRIVILEGES;
quit
exit
reboot
service mysql restart
Open Navicat, click the new connection of the file, and enter a string of characters
Connection failed hehe
It turns out that my Navicat version is a bit low, and I need to add a rule for compatibility
mysql command
ALTER USER '用户名'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
If an error is reported that the root user does not have SYSTEM_USER authority, add this command
grant system_user on *.* to 'root';
Refresh, success