【Linux】CentOS6上mysql5.7安裝
阿新 • • 發佈:2018-11-15
1.下載安裝yum源
根據系統下載yum源
https://dev.mysql.com/downloads/repo/yum/
rpm -ivh xxxxx.rpm
2.修改yum源
vim /etc/yum.repos.d/mysql-community.repo
enable想要下載的版本
3.安裝mysql
yum install mysql-community-server
4.啟動
配置裡修改了以下datadir路徑
vim /etc/my.cnf
啟動服務
service mysqld start
檢視root初始密碼
grep 'temporary password' /var/log/mysqld.log
登入資料庫
shell> mysql -uroot -p
此時使用會報錯“You must reset your password using ALTER USER statement before executing this statement.”
使用以下步驟設定新密碼:
step 1: SET PASSWORD = PASSWORD('your new password');
step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
step 3: flush privileges;
設定完成後重新登入資料庫