YUM CentOS 7 64位下mysql5.7安裝配置

來源:互聯網
上載者:User

標籤:cte   大小寫   community   enter   sys   通過   ant   改密碼   圖表   

配置YUM源

在MySQL官網中下載YUM源rpm安裝包:http://dev.mysql.com/downloads/repo/yum/

#下載mysql源安裝包

# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

# 安裝mysql源
# yum localinstall mysql57-community-release-el7-8.noarch.rpm

 

檢查mysql源是否安裝成功

# yum repolist enabled | grep "mysql.*-community.*"

看到表示安裝成功

 

 

 

安裝MySQL

# yum install mysql-community-server

 

啟動MySQL服務

# systemctl start mysqld

查看MySQL的狀態

# systemctl status mysqld

看到表示啟動成功

 

 

開機啟動

# systemctl enable mysqld

# systemctl daemon-reload

 

修改root本地登入密碼修改密碼原則

mysql5.7預設安裝了密碼安全檢查外掛程式(validate_password),預設密碼檢查策略要求密碼必須包含:大小寫字母、數字和特殊符號,並且長度不能少於8位。

參考:MySQL官網密碼原則詳細說明:http://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_validate_password_policy

 

在/etc/my.cnf檔案添加validate_password_policy配置,指定密碼原則

測試環境可以不要求輸入密碼策略,在my.cnf檔案中添加如下配置禁用即可:

validate_password = off

 

重新啟動mysql服務使配置生效:

# systemctl restart mysqld

 

root預設密碼

mysql安裝完成之後,在/var/log/mysqld.log檔案中給root產生了一個預設密碼。

通過下面的方式找到root預設密碼,然後登入mysql

# grep ‘temporary password‘ /var/log/mysqld.log

 

# mysql -u root -p

Enter password:

 

添加遠程登入使用者

預設只允許root帳戶在本地登入,如果要在其它機器上串連mysql,必須修改root允許遠端連線,或者添加一個允許遠端連線的帳戶

修改root允許遠程

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘;

mysql> flush privileges;

 

 

配置預設編碼為utf8

修改/etc/my.cnf設定檔,添加編碼配置

character_set_server=utf8
init_connect=‘SET NAMES utf8‘

 

 

重新啟動mysql服務

# systemctl restart mysqld

YUM CentOS 7 64位下mysql5.7安裝配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.