Common reasons include:

The firewall of the VM does not set 3306 to the enabled port number.

The second is: there is no set access IP to % or client IP. Error 1045 is caused.

Set mode

1 mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
2 mysql>FLUSH PRIVILEGES;
3 mysql>exit;
Copy the code

For details on mysql configuration, please refer to my last article

Juejin. Cn/post / 684490…