喵星之旅-狂奔的兔子-centos7安装MySQL 8

这里的MySQL版本是8.0.30

一、卸载原有的,包括默认有的和后来自己装的,参看

喵星之旅-狂奔的兔子-centos7安装MySQL 5.5

二、下载文件,参考资料同上

三、安装

解压:
 tar -xvf mysql-8.0.30-1.el7.x86_64.rpm-bundle.tar

 


依次安装:
rpm -ivh mysql-community-common-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.30-1.el7.x86_64.rpm
安装完之后会发现启动失败:
 

执行下面权限命令后再启动(如果直接成功则跳过此步直接登录):
chmod -R 777 /var/lib/mysql/auto.cnf
chown mysql:mysql /var/lib/mysql -R;
systemctl start mysqld


查看密码
cat /var/log/mysqld.log | grep password

密码为 %3?aA0<yFAIt


密码修改:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Admin!123';


默认只能本机登录,远程可以使用ssh方式登录或者单独配置。

 

posted @ 2022-12-27 18:14  喵星兔  阅读(36)  评论(0编辑  收藏  举报