mysql 授权命令操作

在mysql5.7以下的版本如下:
UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='127.0.0.1' or host='localhost';

//把空的用户密码都修改成非空的密码就行了。

在mysql5.7版本如下:

UPDATE mysql.user set authentication_string=password('newpassword') where user='root' and host='127.0.0.1' or host='localhost';


GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH  GRANT OPTION;  

 FLUSH PRIVILEGES;

如果我的文章对你有帮助,就请博主喝杯咖啡吧

mysql 授权命令操作