mysql

mysql忘记密码

1
2
3
4
5
6
7
8
# 登录
mysql -uroot -p

# 跳过mysql账户验证登录
mysqld --skip-grant-tables

# 输入密码后,重置密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123123');

允许root远程登录

1
2
3
grant all privileges on *.* to 'root'@'%' identified by 'pwd' with grant option;

flush privileges;

mysql卸载

查看依赖

1
dpkg --list|grep mysql

卸载

1
2
sudo apt-get remove mysql-common
sudo apt-get autoremove --purge mysql-server-5.7

清空残留数据

1
dpkg -l|grep ^rc|awk '{print$2}'|sudo xargs dpkg -P