NO1.使用Navicat链接MySQL数据库报错
报错内容:
Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found.
方案:
- 命令行登录MySQL
mysql -u root -p
- 输入SQL语句,其中语句中的yourpassword是MySQL密码。
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
No2.Ubuntu忘记mysql密码处理
需求:
Ubuntu下的MySQL密码遗忘。
解决:
- 停止mysql服务
sudo /etc/init.d/mysql stop
- 进入安全模式登录
sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo /usr/bin/mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
- 修改root密码
use mysql;
update user set authentication_string=PASSWORD("你的新密码") where User='root';
update user set plugin="mysql_native_password";
lush privileges;
quit;
No3.Ubuntu彻底卸载MySQL
需求:
卸载MySQL
方案:
- 卸载删除MySQL
sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common
- 删除赘余,清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
sudo find /etc -name "*mysql*" |xargs rm -rf
- 检查是否卸载干净
sudo dpkg -l | grep mysql