首页 > 代码库 > CentOS6.5安装MySQL5.7(也适合其他版本安装)

CentOS6.5安装MySQL5.7(也适合其他版本安装)

 1、查看是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错:

方法一:yum list installed | grep mysql
方法二:rpm -qa |grep mysql


2、下载载mysql57-community-release-el6-5.noarch.rpm
wget https://repo.mysql.com//mysql57-community-release-el5-8.noarch.rpm --no-check-certificate

(下载站点:https://dev.mysql.com/downloads/repo/yum/)

3、安装rpm文件
yum install -y mysql57-community-release-el5-8.noarch.rpm
安装完成后,可以在/etc/yum.repos.d中看到增加的文件

 

4、查看mysql5.7是否启用
yum repolist enabled | grep mysql

 

5、安装mysql
yum install mysql-community-server

 

6、启动mysql服务,初始化
service mysqld start

 

7、查看密码登录并修改密码
grep "password" /var/log/mysqld.log

update mysql.user set authentication_string=password(‘wclwcw1101!‘) where user=‘root‘ and Host = ‘localhost‘;

CentOS6.5安装MySQL5.7(也适合其他版本安装)