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

1. 新建目录:/opt/mysql,并cd进去

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

2.下载mysql安装包:运行wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar

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

3. 解压:运行tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar

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

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

4.查询是否自带数据库:运行rpm -qa|grep mari,查询mariadb相关安装包

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

5.删除自带数据库:运行rpm -e --nodeps mariadb-libs,卸载

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

6.然后开始真正安装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

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

注: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

7.启动mysql:运行systemctl start mysqld.service

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

8.查看root初始密码:mysql自动给root用户设置随机密码,运行grep "password" /var/log/mysqld.log可看到当前密码

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

 9.登录:运行mysql -u root  -p,用root用户登录,提示输入密码可用上述的,可以成功登陆进入mysql命令行

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

 10.设置密码:运行set password for ‘root‘@‘localhost‘ =password(‘P@ssw0rd_2770‘);

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

 11.运行flush privileges;使密码设置生效.

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

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

上一篇:django中根据模型生成页面的脚手架app-groundwork


下一篇:mysql《一》