mysql各种神坑

1.service mysqld start [ERROR] [MY-011011] [Server] Failed to find valid data
解決方法:
a.查看/etc/my.cnf的datadir路径
vi /etc/my.cnf

b.更正datadir路径
根据 Failed to find valid data directory. 修改路径
b1 找出mysql文件夹
#whereis mysql
在这里插入图片描述

b2.在/etc/my.cnf里更正datadir路径位置(
datadir=/var/lib/mysql
改为 datadir=/usr/lib64/mysq1

c.重新启动mysql服務
#service mysqld start

  1. Access denied for user ‘root’@‘localhost’ (using password: YES)
    在这里插入图片描述
    解决:
    1.打开/etc/my.cnf or /etc/mysql/my.cnf,
    在mysqld下添加 skip-grant-tables
    重启 Mysql
    重新登录mysql: mysql -u root -p
    Run mysql> flush privileges;
    重新创建密码: ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘NewPassword’;
    打开 /etc/my.cnf去掉skip-grant-tables
    重启 Mysql
    现在可以用新密码登录了 mysql -u root -p

3.远程连接MYSQL提示Host is not allowed to connect to this MySQL server

在这里插入图片描述
3.Navicat Premium连接MySQL数据库出现Authentication plugin ‘caching_sha2_password’ cannot be loaded的解决方案
在这里插入图片描述

4.远程连接mysql出现 Access denied for user ‘root’@’%’ (using password: YES)
原因a:可能是账号密码错了
原因b:可能未设置远程访问
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_36912167/article/details/104938660