Today, I want to use Navicat to remotely connect to the MySQL database in the virtual machine, but I still can’t connect to it. I searched the Internet and found that the reason is MySQL's authorization problem for remote user login. Here is the solution after I referenced several documents online:
First, use root privileges to enter MySql
mysql -uroot(这里是你的MySQL用户名) -p123456(这里是你的MySQL密码)
2. Then grant permissions to other computers
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
##(这里不要搞错用户名和密码,是你自己的)
At this time, connect to MySQL remotely through Navicat and test the link, as shown in the figure below. This is a successful connection.
Reference documents: The first chapter The second