【Linux CentOS】CentOS 7 YUM 安裝 MySQL 5.7

來源:互聯網
上載者:User

標籤:

在 MySQL 官網下載對應版本的 YUM 源:http://dev.mysql.com/downloads/repo/yum/

# 下載源$ wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm# 安裝源$ rpm -ivh mysql57-community-release-el7-9.noarch.rpm# 安裝 MySQL,會自動安裝依賴軟件$ yum install -y mysql-server# 修改 MySQL 設定檔$ vi /etc/my.cnf# 修改或關閉 MySQL 密碼策略(任選一行):validate_password_policy = 0validate_password = off# 修改默認編碼為 UTF-8,添加在 [mysqld] 後character_set_server=utf8init_connect=‘SET NAMES utf8‘# 啟動 MySQL 服務;systemctl 是用來替代 service 和 chkconfig 的,具體百度$ systemctl start mysqld# 開機啟動 MySQL 服務$ systemctl enable mysqld# 重新加載服務$ systemctl daemon-reload# 查看 MySQL 的 root 用戶密碼,啟動後會在 /var/log/mysqld.log 中給 root 產生密碼$ grep ‘temporary password‘ /var/log/mysqld.log# 使用 root 用戶登錄 MySQL$ mysql -uroot -p# 修改 MySQL 的 root 用戶密碼mysql> alter user ‘root‘@‘localhost‘ identified by ‘新密碼‘;# 添加遠程登錄用戶,具體百度mysql> grant 權限 privileges on 數據庫.表或其它 to ‘用戶名‘@‘%‘ identified by ‘密碼‘ with grant option;# 退出 MySQLmysql> quit;

 

參考地址:http://blog.csdn.net/xyang81/article/details/51759200

【Linux CentOS】CentOS 7 YUM 安裝 MySQL 5.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.