Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql Foundation (4) user Rights Management and root password recovery

Shulou Source: shulou.com Published: 2022-06-01 16:07:07 10月04日 Update

The mysql user consists of the user and hostname, which is indicated by 'user'@'hosst'. The user and permission information of mysql is stored in the mysql library.

Mysql database tables:

User # user account, global permissions

Db # Library-level permissions

Host # Host

Tables_priv # Table level permissions

Colums_priv # field-level permissions

Procs_priv # permissions related to stored procedures and stored functions

Proxies_priv # proxy user rights

Permission level:

Library level

Table level

Field level

Mysql user rights GRANT rights list ON database. Table 'user name' @ 'host address' IDENTIFIED BY 'password; # authorized user example: mysql > GRANT CREATE,SELECT ON *. * TO' tr'@'localhost' IDENTIFIED BY 'mypass'; REVOKE permission list ON database. Table FROM 'username' @ 'host address' # revoke authorization example: mysql > REVOKE SELECT ON *. * FROM 'tr'@'localhost'; mysql > SHOW GRANTS FOR' tr'@'localhost'; # View the authorization of the specified user mysql > SELECT USER,HOST,PASSWORD FROM mysql.user; # View all user information

Mysql permission list:

Mysql root password recovery vim my.cnf # modify profile [mysqld] skip-grant-tables # login database skips authorization table (required) skip-networking # forbids users from connecting from the network (for security purposes) service mysqld restart # restart mysql mysql > UPDATE user SET Password=PASSWORD ('root') WHERE User='root' # Update root password

Tags: Permissions user level host data database password storage information address field user name security global function situation file network account procedure Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB Docker vpn Linux