標籤:mysql 修改使用者密碼 授權 grant
MYSQL 建立使用者,並授權,修改密碼。
建立使用者並將所有許可權,授權給LAW
create user [email protected];
grant all privileges on *.* to [email protected] identified by ""; ----OK
建立本機使用者空密碼,並授予相關選擇,更新等許可權,且只能作用於mysql資料庫。
create user [email protected];
grant select,update,insert on mysql.* to [email protected] identified by "";
更改LAW的密碼
mysql> set password for [email protected] = "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 [email protected] = "*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