4 of mysql series ---- password management, authorization, graphical management

A, mysql password cracking

1, change the password at a shell command line

  mysqladmin   -hlocalhost  -uroot    -p   password "123456"

2, crack the code

A, which added to the configuration file: skip-grant-tables, restart the service

B, look mysql.user table, find authentication_string field

C, updated password: update mysql.user set authentication_string = password ( "123456")

     where user="root" and host="localhost";

D, refresh the configuration: flush privileges;

E, modify the configuration file: option to skip the password to cancel commented

F, restart the service, log in with the new password to verify

Second, the user authorization and privileges revoked

1、grant all on . to [email protected] identified by "123456" with grant option

//给man用户在192.168.4.5这台客户端上所有的库有所有的权限,

  登陆密码是123456,并有授权权限,也就是可以在客户端给别的用户授予权限

2, the client viewing permissions:

   select   @@hostname;    //显示连接服务器的主机名

   select  user();                //显示当前登陆的用户和客户端主机的ip 地址  

   show grants;                //查看登陆用户的权限

   show processlist;       //查看当前用户客户端连接服务器的状况

3, revoke the authorization

 show grants for root@"%";  //查看root用户在所有客户端上的权限

 revoke  grant  option  on  *.*  from root@'%'   //撤销授权权限

 revoke delete on *.* from root@'%';   //撤销删除的单个权限

4, mysql authorize:

  user:                   存储已有的授权用户

  db:                       存储授权用户对库的访问权限

  tables_priv:         对表的访问权限

  columns_priv:     对表中字段的访问权限

  select * from mysql.user  where user="root"\G

 //查看root用户的所有的权限列表

  drop  user  用户名@'客户端地址';//删除已授权的帐号

5, set password = password ( "New Password") // modify the user's own password

 set password for 用户名@"客户端地址"=password("新密码");  //管理员修改密码

Three, mysql graphical management tool

1, install httpd, php, php-mysql, start web service

2、解压:tar -zxf phpMyAdmin-2.11.11-all-languages.tar.gz -C /var/www/html/

3, at / var / www / html: mv phpMyAdmin-2.11.11-all-languages ​​phpadmin

4, chown -R apache: apache phpadmin // modify the running account permissions

5, cp config.sample.inc.php config.inc.php // generate the master configuration file

6, modify the main configuration file: config.inc.php, modifications 17 and 31 rows

7, restart the web service

8, http://192.168.4.51/phpadmin // client-side validation, landing

Guess you like

Origin blog.51cto.com/14421478/2415007