centos6.5上安装5.7版本的mysql

时间:2021-01-30 11:06:22

centos6.5上安装5.7版本的mysql

https://www.cnblogs.com/lzj0218/p/5724446.html

设置root可以在本机以外的机器访问

mysql -uroot -ppassword

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

修改root账号密码

> use mysql;

>  update user set password=password('titxxxee') where user='root' and host='%';

>  flush privileges;

新增用户并授权, 账号myuser可以采用密码mypassword,从固定ip访问所有数据库的所有表

grant all privileges on *.* to 'myuser'@'192.168.0.1' identified by 'mypassword' with grant option

*.*代替,表示赋予用户访问所有数据库的所有表