Mysql open and close remote access

Open remote access, log in to Mysql and execute:

grant all privileges on ssss.* to root@"%" identified by "sssss" with grant option;

the first ssss represents the database name, if you use * to represent all databases, it is best to specify You only want to expose to the Internet.

Sometimes you want to close for security:

first query:

select user,host from user where user = "root" and host= "%";
flush privileges;

if there is a record:

delete from user where user = "root" and host= "%";
flush privileges;

Add one point, permissions on stored procedures:
grant ALTER ROUTINE,CREATE ROUTINE on sss.* to 'sss'@'%';
flush privileges;
The above represents setting the creation and modification of database sss for user sss Stored procedure permissions.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326463433&siteId=291194637