yum安裝mysql5.7
阿新 • • 發佈:2017-11-22
mysql- div 生效 user href use 文件 install 添加 1. mysql官方下載yum源
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2. 安裝mysql源
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
3. yum安裝
yum install -y mysql mysql-server
4. 檢查mysql源是否安裝成功(如圖,即安裝成功)
yum repolist enabled | grep "mysql.*-community.*"
5. 查看默認生成的密碼
grep ‘temporary password‘ /var/log/mysqld.log
6. 修改密碼
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
7. 默認安裝了密碼安全檢查插件,如不需要,在my.cnf添加配置(重啟生效)
validate_password = off
8. 添加遠程登錄用戶
GRANT ALL PRIVILEGES ON *.* TO ‘yangxin‘@‘%‘ IDENTIFIED BY ‘Yangxin0917!‘;
9. 配置默認編碼為utf8
(1)修改/etc/my.cnf配置文件,在[mysqld]下添加編碼配置,如下所示:
[mysqld] character_set_server=utf8 init_connect=‘SET NAMES utf8‘
(2)重啟mysql並查看
show variables like ‘%character%‘;
yum安裝mysql5.7