mysql数据库

2019-10-25  本文已影响0人  Binary_r

ALTER USER USER() IDENTIFIED BY 'shtroot'; 修改数据库密码

ysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;

允许所有用户远程访问 修改用户名和密码为你自己的

mysql> GRANT ALL PRIVILEGES ON . TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

允许单个ip 修改用户名和密码为你自己的

mysql> GRANT ALL PRIVILEGES ON . TO 'USERNAME'@'1.2.3.4' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

最后

mysql> FLUSH PRIVILEGES;

设置mysql8.0密码

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';

上一篇下一篇

猜你喜欢

热点阅读