Ali cloud ECS server, mysql can not access the external network

Refer https://www.jianshu.com/p/7a41734b502e

problem causes

Remote IP address unauthorized access. The default root user can only log on localhost is the machine

solution

  1. On the database server login, and then execute the following SQL statement authorization. The meaning of the SQL statement by any authorized IP address to log in as the root user database, operating any object in any database.

Therefore it needs to authorize other IP addresses.

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

 Parameters described below.

    •  *. *  Parameters, the first "*" is a placeholder for the database, if filled, "*" represents all databases. The second "*" for the database object placeholder, if you enter "*" is the database of all objects representative.
    •  ' Root ' @ ' % '  parameters, root database account as an authorized login, "%" as the IP address placeholders. If you want only to such limitations 1.1.1.1 logged in, you need to take "%" to 1.1.1.1. If you fill in "%" represents allows any IP address to log in.
    •  ' 123456 '  parameter, which is a database password.

   2, execute SQL statements, refresh permission.

flush privileges;

   3. Confirm that the remote MySQL clients can connect to your database.

  

 

 

Guess you like

Origin www.cnblogs.com/bobkingblog/p/11853184.html