修改MySQL中权限,为远程授权
Posted mslog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了修改MySQL中权限,为远程授权相关的知识,希望对你有一定的参考价值。
在进入mysql之后,输入相应的语句:
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION; 其中‘myuser‘、‘mypassword‘ 需要替换成实际的用户名和密码。 例如GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘admin‘ WITH GRANT OPTION;
可能会报错,如下:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
改正:
mysql> set password=password(‘admin‘); Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘admin‘ WITH GRANT OPTION; FLUSH PRIVILEGES; Query OK, 0 rows affected, 1 warning (0.00 sec) Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> quit; Bye
成功修改
以上是关于修改MySQL中权限,为远程授权的主要内容,如果未能解决你的问题,请参考以下文章