MariaDB and MySQL permissions and remote connectivity

We may have links to this database as a user with root name! But not the default remote access!

If you want to remotely access how to deal with it?

1 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

2 FLUSH PRIVILEGES;

The second line is to make the changes to take effect immediately, without restarting the database;

The first line is the distribution of competences!

ALL PRIVILEGES represents all the permissions

*. * Represents the database. Here is a list of all databases, all tables

'Root' @ '%' represents the user name in the address which identifies all IP addresses%, as we can remember or input mask segment, remember to clear the Ha ha ha.

'Password' where the password to log in

GRANT OPTION indicates that these have permissions to redistribute.

By extension!

1 GRANT select on DB1.xxSummary TO 'outsider1'@'%' IDENTIFIED BY '123456aaa'  WITH GRANT OPTION;

2 GRANT select(col1,col2) on DB1.xxSummary TO 'outsider1'@'%' IDENTIFIED BY '123456aaa'  WITH GRANT OPTION;

The first sentence of this person realize outsider1 user can only Select in the table xxSummary DB1,

GRANT command if no user creates a user, if he would modify permissions.

The second sentence of the person the user can only achieve outsider1 Select col1 field in the table xxSummary of DB1 and col2,

Guess you like

Origin www.linuxidc.com/Linux/2020-03/162671.htm