1、去官網查找最新(你需要的)安裝包版本
# https://dev.mysql.com/downloads/repo/yum/
2、下載MySQL安裝包
# wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
3、安裝MySQ源
# yum -y install mysql80-community-release-el7-3.noarch.rpm
4、查看安裝結果
# yum repolist enabled | grep mysql.*
mysql-connectors-community/x86_64 MySQL Connectors Community 128
mysql-tools-community/x86_64 MySQL Tools Community 100
mysql80-community/x86_64 MySQL 8.0 Community Server 145
5、安裝MySQL服務
# yum install mysql-community-server -y
6、啟動MySQL
# service mysqld start # netstat -lntp | grep 3306 //查看3306埠是否起了
# systemctl status mysqld.service //查看MySQL的運行狀態
7、查看MySQL日志,篩選出臨時密碼
# grep "password" /var/log/mysqld.log
8、用臨時密碼登錄到MySQL
# mysql -uroot -p
9、更改root密碼,密碼要大小寫加字符(密碼有復雜性要求)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpasswd';
10、修改 /etc/my.cnf 或 /etc/mysql/my.cnf,檔案加入 utf-8編碼
# vim /etc/my.cnf //把下面代碼粘進去就好 [client] default-character-set = utf8 [mysqld] default-storage-engine = INNODB character-set-server = utf8 collation-server = utf8_general_ci # service mysqld restart //重啟資料庫即可
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/119322.html
標籤:MySQL
上一篇:關系資料模型要素之關系完整性約束
下一篇:MySQL的資料庫定義語法
