linux(CentOS7.6)下安装mysql5.7.26

1.下载安装包

mkdir  -p /opt/mysql
cd /opt/mysql

wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar

2. 解压安装包

tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar

3.删除系统自带数据库mariadb

PS:centos7.6自带的类mysql数据库是mariadb,会跟mysql冲突,要先删除。

查询mariadb相关安装包并卸载

rpm -qa|grep mari

rpm -e --nodeps mariadb-libs

 

4.安装mysql

依次运行以下几条

rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm

 

注:libaio.so.1()(64bit) is needed by MySQL-server 问题解决办法

[root@localhost upload]# rpm -ivh MySQL-server-5.5.25a-1.rhel5.x86_64.rpm
error: Failed dependencies:
libaio.so.1()(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64

libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64

解决办法:

yum install libaio

5.启动mysql

systemctl start mysqld.service

6.查看root初始密码

mysql自动给root用户设置随机密码,查看当前随机密码

grep "password" /var/log/mysqld.log

 7.登录

用root用户登录,提示输入密码可用上述的,可以成功登陆进入mysql命令行

mysql -u root  -p

 8.设置密码

set password for 'root'@'localhost' =password('P@ssw0rd_2770');

 9.使密码设置生效

flush privileges;

10.设置开机自启

systemctl enable mysqld

posted @ 2021-07-06 22:13  我是一粒沙  阅读(811)  评论(0编辑  收藏  举报