MySQL 8.0 does not support the following command

grant all privileges on *.* to root@"%" identified by ".";
Copy the code

The correct way to write this is to create the user first

CREATE USER 'root'@'%' IDENTIFIED BY 'yourpassword'; 'Copy the code

Then authorize the user

grant all privileges on *.* to 'root'@'%' ;

Copy the code

PS: If Navicat connects to the remote database, error 1251 is reported

Cause: Before mysql8, the encryption rule was mysql_native_password. After mysql8, the encryption rule is caching_sha2_password.

Method 1: Upgrade Navicat

Method 2: Restore the encryption rule of the mysql user login password to mysql_native_password

# to check the plugin select the host, the user, the plugin, authentication_string from mysql. The user; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'yourpassword';Copy the code