MYSQL 创建用户,并授权,修改密码。
创建用户并将所有权限,授权给LAW
create user law@localhost;
grant all privileges on *.* to law@localhost identified by ""; ----OK
创建本地用户空密码,并授予相关选择,更新等权限,且只能作用于mysql数据库。
create user david@localhost;
grant select,update,insert on mysql.* to david@localhost identified by "";
更改LAW的密码
mysql> set password for law@localhost = "123.law";
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
当直接输入123.law密码时会提示一个错误,这里你需要将密码转换为16进制。
命令为:
select password("123.law");
mysql> select password(‘123.law‘);
+-------------------------------------------+
| password(‘123.law‘) |
+-------------------------------------------+
| *2FFDFCDC4937DB95AC813D3962BECF39B3D78BE3 |
+-------------------------------------------+
1 row in set (0.00 sec)
得到一串16进制密码后,再次执行命令:
********************************************************************************************
* set password for law@localhost = "*2FFDFCDC4937DB95AC813D3962BECF39B3D78BE3"; *
*******************************************************************************************
以下为在执行phpmyadmin 时官方MYSQL执行命令:
REVOKE ALL PRIVILEGES ON * . * FROM ‘lisa‘@‘%‘;
REVOKE GRANT OPTION ON * . * FROM ‘lisa‘@‘%‘;
GRANT SELECT ,
INSERT ,
UPDATE ,
DELETE ON * . * TO ‘lisa‘@‘%‘ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
本文出自 “霸王别集” 博客,请务必保留此出处http://zhangtainren.blog.51cto.com/448826/1539386