1.解压
tar -xvf mysql-8.0.28-1.el8.aarch64.rpm-bundle.tar
2.安装必须软件(务必根据顺序)
rpm -ivh mysql-community-common-8.0.28-1.el8.aarch64.rpm
rpm -ivh mysql-community-client-plugins-8.0.28-1.el8.aarch64.rpm
rpm -ivh mysql-community-libs-8.0.28-1.el8.aarch64.rpm
rpm -ivh mysql-community-client-8.0.28-1.el8.aarch64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.28-1.el8.aarch64.rpm
rpm -ivh mysql-community-server-8.0.28-1.el8.aarch64.rpm
3.修改配置文件
vim /etc/my.cnf
在末尾补一行:
lower_case_table_names=1
//1:数据库大小写不敏感
//0:数据库大小写敏感
4.初始化数据库
mysqld --initialize --console
5.目录授权
chown -R mysql:mysql /var/lib/mysql/
6.启动mysql服务
systemctl start mysqld
7.编辑下环境变量
vim /etc/profile
末尾加上一行:
export PATH=$PATH:/usr/bin/mysq
8.查看临时密码
cat /var/log/mysqld.log
9.用临时密码登录
mysql -u root -p
10.修改密码
alter USER 'root'@'localhost' IDENTIFIED BY '123456';
//红色设置自己的密码
navicat远程连接报错
1251 client does not support authentication protocol requested by server;consider upgrading Mysql client
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
先登录mysql
mysql -u root -p
//输入密码
mysql> use mysql;
mysql> select user,host from user;
你可能执行的是:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';
改成:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
如果还是不行:
尝试一:重置密码为空
先登录MySQL,重置密码为空,并刷新
update user set authentication_string='' where user='root';
flush privileges;
再用上面的方法修改密码
navicat远程连接报错
Authentication plugin ‘caching_sha2_password‘ cannot be loaded...
1、登录Mysql:
mysql -u root -p
2、修改账户密码加密规则并更新用户密码:
//修改加密规则(可以直接复制)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
//更新一下用户的密码(可以直接复制)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
3、刷新权限并重置密码
//刷新权限(可以直接复制)
FLUSH PRIVILEGES;
4、重置密码
//此处请自定义密码,红色的root就是博主自定义的密码
alter user 'root'@'localhost' identified by 'root';
此处将密码改为root
5、重新打开软件,再次连接数据库即可
版权归原作者 辙止浅尝レ 所有, 如有侵权,请联系我们删除。