centos下mysql 8 安装教程和解决navicat连接报错1251

安装mysql8

从官网下载rpm文件并上传


rpm -ivh mysql57-community-release-el7-11.noarch.rpm
更新 yum 命令

yum clean all
yum makecache
安装mysql-server

yum install mysql-community-server 
开启mysql服务

systemctl start mysqld.service 

查看初始密码并登陆

cat /var/log/mysqld.log | grep password  
mysql -u root -p

修改密码,如果报错请包涵大小写数字和特殊符号

 ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码'; 
Navicat 连接 Mysql8
修改mysql数据库下的user表中host的值

mysql -u root -p  
use mysql;  
update user set host='%' where user='root';  
赋予任何主机访问数据的权限

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; 
mysql>FLUSH PRIVILEGES;  
连接报1251错误解决方法
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';

你可能感兴趣的:(linux)