MySQL错误处理

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.

方案:

  1. 命令行登录MySQL
mysql -u root -p
  1. 输入SQL语句,其中语句中的yourpassword是MySQL密码。
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';

No2.Ubuntu忘记mysql密码处理

需求:
Ubuntu下的MySQL密码遗忘。
解决:

  1. 停止mysql服务
sudo /etc/init.d/mysql stop
  1. 进入安全模式登录
 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
  1. 修改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
方案:

  1. 卸载删除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
  1. 删除赘余,清理残留数据
 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
 sudo find /etc -name "*mysql*" |xargs rm -rf
  1. 检查是否卸载干净
 sudo dpkg -l | grep mysql
发布了15 篇原创文章 · 获赞 9 · 访问量 2648

猜你喜欢

转载自blog.csdn.net/qq_38413498/article/details/104768924
今日推荐