yum 安裝 MySQL5.7 最簡單的方法!
阿新 • • 發佈:2017-07-10
版本 grant 字符 length mysqld sql download 小寫 error
yum 安裝 MySQL5.7 最簡單的方法!
正文
第一步 安裝CentOS 略
CentOS 版本為6.5
第二步 安裝 yum 倉庫列表
使用yum 安裝mysql,要使用mysql的yum倉庫,先從官網下載適合你系統的倉庫
https://dev.mysql.com/downloads/repo/yum/
我下載的是 mysql57-community-release-el6-11.noarch.rpm
安裝 yum localinstall mysql-community-release-el6-5.noarch.rpm
第三步 安裝mysql
yum install mysql-community-server
第四步 啟動mysql
sudo service mysqld start
第五步 設置root用戶密碼
查看初始密碼
grep “password” /var/log/mysqld.log
2017-06-11T20:14:59.383788Z 1 [Note] A temporary password is generated for [email protected]: e.Vsb5=28=.v
密碼為 :e.Vsb5=28=.v
SET PASSWORD FOR [email protected] = PASSWORD(‘14130220’); // 為root賬號設置密碼
此時如有報錯 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
設置密碼過於簡單
set global validate_password_policy=0; // 默認1 即必須含有1個數字、小寫或大寫字母、特殊字符
set global validate_password_length=4; // 默認8 即密碼長度
第六步 mysql遠程連接授權
GRANT ALL PRIVILEGES ON . TO [email protected]%’ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
註意:’myuser’、’mypassword’ 需要替換成實際的用戶名和密碼。
第七步 添加以下配置:(解決中文亂碼)
vim /etc/my.cnf
[mysql]
default-character-set=utf8
[mysqld]
character_set_server=utf8
重啟
service mysqld restart
yum 安裝 MySQL5.7 最簡單的方法!