centos6.9安装mysql5.7

Step1: 检测系统是否自带安装mysql

yum list installed | grep mysql

Step2: 删除系统自带的mysql及其依赖

yum -y remove mysqlXXXXXXX

Step3: 给CentOS添加rpm源,并且选择较新的源

获取rpm

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

安装mysql源

yum localinstall mysql-community-release-el6-5.noarch.rpm

查看启用情况

yum repolist all | grep mysql

禁用其他设置启用mysql57

yum-config-manager --disable mysql55-community

yum-config-manager --disable mysql56-community

yum-config-manager --enable mysql57-community-dmr

yum repolist enabled | grep mysql

Step4:安装mysql 服务器命令:

yum install mysql-community-server

Step5:启动MySQL服务

Service start mysqld

Step6:查看root 临时密码

grep 'temporary password' /var/log/mysqld.log

Step7:修改root密码

mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456aA?';

Step8:设置远程用户

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456aA?' WITH GRANT OPTION;

etp9:设置3306端口

vi /etc/my.cnf

增加:

[client]

port = 3306

default-character-set = utf8mb4

你可能感兴趣的:(centos6.9安装mysql5.7)