1、rpm安装方式顺序:
下载:
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.19-1.el6.x86_64.rpm
安装顺序:
Installing : mysql-community-common-5.7.19-1.el6.x86_64 Installing : mysql-community-libs-5.7.19-1.el6.x86_64 Installing : mysql-community-libs-compat-5.7.19-1.el6.x86_64 Installing : mysql-community-client-5.7.19-1.el6.x86_64
2、yum安装方式
下载:
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
安装:
rpm -ivh mysql57-community-release-el6-11.noarch.rpm
yum -y install mysql-community-server
3、卸载mysql5.7.19
rpm -qa|grep -i mysql yum remove mysql-community-libs-5.7.19-1.el6.x86_64 mysql-community-client-5.7.19-1.el6.x86_64 mysql57-community-release-el6-11.noarch mysql-community-common-5.7.19-1.el6.x86_64 mysql-community-libs-compat-5.7.19-1.el6.x86_64 mysql-community-server-5.7.19-1.el6.x86_64 whereis mysql //查看安装目录,分别删除
4、初始化mysql
#查看是否开机启动 chkconfig --list | grep mysqld #设为开机启动 chkconfig mysqld on #启动mysql进行初始化 service mysqld start #查看密码 grep "password" /var/log/mysqld.log #进入mysql mysql -uroot -p密码 #修改密码 set password for 'root'@'localhost' = password('新密码');
5、修改mysql字符集为UTF-8:
vim /etc/my.cnf; 在[mysqld]部分添加:character-set-server=utf8; 在文件末尾新增[client]段,并在[client]段添加:default-character-set=utf8
6、重启mysqld服务:
service mysqld restart