yum install -y wget
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo_bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-libs-5.5.65-1.el7.x86_64(复制当前环境的mysql)
cd /opt/
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server -y
chown -R root:root /var/lib/mysql
chown root /var/lib/mysql/
service mysqld restart
mysql -u root -p use mysql update user set Password = password('ok') where User='root'; GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "ok";
flush privileges;
exit
yum install -y vim
vim /etc/my.cnf
添加
character-set-server=utf8
service mysqld restart
mysql -uroot -pok