设置IP 访问

##1.默认安装目录
cd C:\Program Files\mysql-5.7.16-winx64\bin

##2.登陆mysql数据库
mysql -uroot -p

##3.查看user表
use mysql;
select host,user from user;

##4.更新IP
update user set host = 'xxx.xx.xx.xxx' where user = 'root';

##5.授权
Grant all on *.* to 'root'@'%' identified by 'xxxxxx' with grant option;
flush privileges;

##6.重启mysql
net stop mysql;
net start mysql;

修改密码

mysql5.6之前修改密码(字段password)

mysql> use mysql;

mysql> update user set password=password(‘123‘) where user=‘root‘ and host=‘localhost‘;

mysql> flush privileges;

mysql 5.7.22版本修改密码(字段是authentication_string)

mysql> use mysql;

mysql>update user authentication_string=password(‘root123‘) where user=‘root‘

mysql> flush privileges; --不重启MySQL服务生效

 

相关文章:

  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-01-17
  • 2021-09-02
  • 2021-12-27
  • 2022-01-10
猜你喜欢
  • 2022-02-03
  • 2021-11-28
  • 2021-09-01
  • 2021-11-12
  • 2021-08-05
相关资源
相似解决方案