MySQL user consists of user and host name, using ' user ' @ ' hosst ' to indicate that MySQL user and permission information is stored in MySQL library
MySQL database table:
User #用户账号, global permissions
DB #库级别权限
Host #主机
Tables_priv #表级别权限
Colums_priv #字段级别权限
Procs_priv #存储过程和存储函数相关的权限
Proxies_priv #代理用户权限
Permission level:
Library level
Table level
Field level
MySQL User rights GRANT permission list on database. Table ' username ' @ ' host address ' identified by ' password '; #授权用户 example:mysql> GRANT create,select on * * to ' tr ' @ ' localhost ' identified by ' mypass '; REVOKE permissions list on database. Table from ' username ' @ ' host address ' #撤销授权例:mysql> REVOKE SELECT on *. * from ' tr ' @ ' localhost '; mysql> SHOW GRANTS for ' tr ' @ ' localhost '; #查看指定用户的授权情况 mysql> SELECT User,host,password from Mysql.user; #查看所有用户信息
MySQL Permissions list:
650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M02/97/E0/wKiom1k0tXrBJpVMAAE9lS5oL-A636.jpg "style=" float : none; "title=" MySQL permissions list. jpg "alt=" wkiom1k0txrbjpvmaae9ls5ol-a636.jpg "/>
650) this.width=650; "src=" https://s1.51cto.com/wyfs02/M00/97/E0/wKiom1k0tXvyMYA9AACokOXMPqM571.jpg "style=" float : none; "title=" MySQL permissions list 2.jpg "alt=" Wkiom1k0txvymya9aacokoxmpqm571.jpg "/>
650) this.width=650; "src=" https://s1.51cto.com/wyfs02/M02/97/E1/wKioL1k0tXvCjaNBAAFonmpuUXU519.jpg "style=" float : none; "title=" MySQL permissions list 3.jpg "alt=" Wkiol1k0txvcjanbaafonmpuuxu519.jpg "/>
MySQL root password recovery vim my.cnf# Modify configuration file [mysqld]skip-grant-tables# login database is skip authorization table (must) skip-networking# prohibit user from network connection (for security reasons) s Ervice mysqld restart# Restart MySQL mysql> UPDATE user SET Password=password (' root ') WHERE user= ' root '; #更新root密码
This article is from the "Automated Operations" blog, please be sure to keep this source http://hongchen99.blog.51cto.com/12534281/1932173
MySQL Basics (iv) User Rights Management and root password recovery