1. 程式人生 > 遊戲資訊 >峽谷晚報:Uzi25歲生日、TheShy談與肉雞分開的原因

峽谷晚報:Uzi25歲生日、TheShy談與肉雞分開的原因

1.安裝wget

yum install -y wget

2.備份

cd /etc/yum.repos.d/

mv CentOS-Base.repo CentOS-Base.repo_bak

3.更換阿里雲yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4. 清除YUM快取並建立快取

yum clean all

yum makecache

5.查詢mariadb並解除安裝

rpm -qa | grep mariadb

rpm -e --nodeps mariadb-libs-5.5.65-1.el7.x86_64(複製當前環境的mysql)

6.下載mysql的repo源並安裝rpm包

cd /opt/

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

7. 安裝mysql

yum install mysql-server -y

8.授予許可權

chown -R root:root /var/lib/mysql

chown root /var/lib/mysql/

9.重啟mysql資料庫

service mysqld restart

10.登入mysql資料庫並授權

mysql -u root -p

use mysql

update user set Password = password('ok') where User='root';

GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "ok";

 

11.使配置生效並退出

flush privileges;

exit

12.安裝vim並設定字符集

yum install -y vim

vim /etc/my.cnf

新增

character-set-server=utf8

13.重啟mysql

service mysqld restart

14.登入mysql資料庫

mysql -uroot -pok