mysql tutorial: allow remote root user to connect

MySQL does not allow remote root connections by default for security reasons. Remote root login means having full control over the MySQL server, so allowing such connections may increase the risk of attacks on the system.

If you really need to allow remote root connections, you can set it up by following these steps:

  1. A command line or graphical interface tool for logging into the MySQL server.
  2. Log in to the MySQL server using the root account.
  3. Run the following command to authorize remote root login:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

In the above command, 'your_password' should be replaced with the actual password you wish to set. This command allows the root user to connect to the MySQL server from any host with any IP address.

Please note that allowing remote root connections is a security risk. It is recommended to enable it only when really needed, and make sure to take other security measures, such as restricting remote access IPs, using strong passwords, and regularly updating the MySQL server.

Guess you like

Origin blog.csdn.net/a772304419/article/details/133351480