一、下载解压
下载地址: MySQL :: Download MySQL Community Server (Archived Versions)
tar -xvf mysql-8.0.32-1.el7.x86_64.rpm-bundle.tar -C /opt/mysql-8.0.32
二、安装
最开始安装一直报错
缺少 libcrypto.so.10库文件,安装openssl可以解决
wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-4.el8.x86_64.rpmrpm -ivh compat-openssl10-1.0.2o-4.el8.x86_64.rpm --nodeps
2.还是按之前的安装方法
rpm -hiv mysql-community-common-8.0.32-1.el7.x86_64.rpm
rpm -hiv mysql-community-client-plugins-8.0.32-1.el7.x86_64.rpm
rpm -hiv mysql-community-libs-8.0.32-1.el7.x86_64.rpm
rpm -hiv mysql-community-client-8.0.32-1.el7.x86_64.rpm --force --nodeps # 安装失败,添加 --force --nodeps
rpm -hiv mysql-community-icu-data-files-8.0.32-1.el7.x86_64.rpm
rpm -hiv mysql-community-server-8.0.32-1.el7.x86_64.rpm
三、启动mysql
启动MySQL服务
systemctl start mysqld查看MySQL的进程并设置服务器开机启动mysql
systemctl status mysqld
systemctl enable mysqld查看初始化密码
cat /var/log/mysqld.log | grep password
mysql启动成功,但是查看版本提示异常
参考博客:mysql启动时报错:error while loading shared libraries: libncurses.so.5: cannot open shared object file的解决办法_Mysql_脚本之家
ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5
ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5
接下来进行下一步操作
查看初始化密码
cat /var/log/mysqld.log | grep passwordmysql -uroot -p 初始密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY '******';use mysql;
update user set host = '%' where user ='root';
flush privileges;ps: 用mysql连接工具就可以正常连接了。