Centos 6,5 安装Mysql 5.7.12

环境:centos6.5 ,mysql5.7.12

下载数据库mysql5.7.12

wget  http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar

tar -xvf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar

cd /mysql-5.7.12-1

创建mysql用户

groupadd mysql
useradd -r -g mysql -s /bin/false mysql
查看原来安装的Mysql 
 rpm -qa | grep mysql
mysql-5.1.71-1.el6.x86_64
mysql-devel-5.1.71-1.el6.x86_64
mysql-libs-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
qt-mysql-4.6.2-26.el6_4.x86_64

Mysql卸载从下往上顺序
rpm -e –nodeps qt-mysql-4.6.2-26.el6_4.x86_64
rpm -e –nodeps mysql-server-5.1.71-1.el6.x86_64
rpm -e –nodeps mysql-libs-5.1.71-1.el6.x86_64
rpm -e –nodeps mysql-devel-5.1.71-1.el6.x86_64
rpm -e –nodeps mysql-5.1.71-1.el6.x86_64
rpm -qa | grep mysql

安装Mysql安装顺序安装
rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm

启动Mysql服务 
service mysqld status

生成随机密码
grep ‘temporary password’ /var/log/mysqld.log
2016-04-30T06:21:17.557372Z 1 [Note] A temporary password is generated for root@localhost:b/xE8hdZoEwJ

登陆mysql  
mysql -uroot -p  
b/xE8hdZoEwJ  系统随机密码

修改Mysql密码–一定要满足复杂性
mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘HanZheng.123’;
Query OK, 0 rows affected (0.00 sec)

5.7中存储密码的字段不再是password了,变成了authentication_string

update mysql.user set authentication_string=password('root') where user='root'';

修改root密码后如果第一次使用root用户登入mysql系统还会需要重置一次root密码

SET PASSWORD=PASSWORD('root');

重新登陆
mysql -uroot -p  
HanZheng.123

你可能感兴趣的:(Centos 6,5 安装Mysql 5.7.12)