Mysql常用操作

一、忘记密码

1、vim /etc/my.cnf

在文件中加入 :skip-grant-tables (这样就可以免密登录了)

 

 

2.进入到mysql数据库

 运行命令:
mysql -u root
mysql -u root

3.修改密码

运行语句:
use mysql;

继续运行语句:
update mysql.user set authentication_string=password('root_password') where user='root';    


root_password
替换成你想要的密码
use mysql;
update mysql.user set authentication_string=password('root_password') where user='root';

4、重启mysql

sudo systemctl restart mysqld

 

二、修改本机地址同linux服务器的ip地址映射

在hosts中添加映射地址

 

 

 

 

 

posted @ 2022-07-26 17:55  新界王  阅读(20)  评论(0)    收藏  举报