CentOS 6.5 下方安裝MySQL 5.7.12詳細步驟(圖文)

PHPz
發布: 2017-04-02 18:00:18
原創
1702 人瀏覽過

CentOS 6.5 下安裝MySQL 5.7.12,使用官網下載的rpm安裝套件

下載安裝套件

這你可以參考:如何從官網下載MySQL最新版本的安裝套件?

解壓縮安裝套件

tar -xvf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
登入後複製

移除已經安裝的早期版本

如果不移除的話,會提示有衝突,版本可能有所不同

yum -y remove mysql-libs-5.1.73*
登入後複製

這個可以參考:

CentOS安裝mysql*.rpm提示conflicts with file from package的解決方法

CentOS下如何完全卸載MySQL?解決卸載不乾淨的問題

安裝順序

rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm 
rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.12-1.el6.x86_64.rpm
登入後複製

啟動Mysql服務

# service mysqld start
初始化 MySQL 数据库:                                      [确定]
Installing validate password plugin:                       [确定]
正在启动 mysqld:
登入後複製

修改管理員密碼

查看初始管理員密碼,以下的指令適用於 RHEL, Oracle Linux, CentOS, and Fedora 平台:

grep 'temporary password' /var/log/mysqld.log
登入後複製

SLES平台使用下面的指令:

grep 'temporary password' /var/log/mysql/mysqld.log
登入後複製

你會發現初始密碼超級的複雜,還好我使用XShell,可以複製貼上

# grep 'temporary password' /var/log/mysqld.log
2016-05-14T02:57:24.372528Z 1 [Note] A temporary password is generated for root@localhost: ?sSq8?.IucXV
[root@localhost /]# 
[root@localhost /]# mysql -uroot -p?sSq8?.IucXV
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.12

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
登入後複製

注意:這種寫法(mysql -uroot -p ?sSq8?.IucXV)有時因密碼中的特殊字元而不可行,需要先執行(mysql -uroot -p),再根據提示輸入密碼。

使用下面的指令修改密碼

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
登入後複製

密碼必須包含大寫字母小寫字母數字和符號,不然會提示:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements(您的密碼不符合目前的安全性原則要求

授權遠端登入

參考:CentOS6.5下透過Shell修改MySQL初始密碼,開啟遠端登錄,授權遠端登入使用者

如果不開啟遠端登入權限,將會遇到類似下面的錯誤:

在用戶端使用Navicat for MySQL 遠端連線就報10038的錯誤

CentOS 6.5 下方安裝MySQL 5.7.12詳細步驟(圖文)

#該問題的案例請參考:mysql遠端報10038錯誤

結束語

注意,使用yum 安裝的和使用rpm安裝的有所不同(要么就是不同的版本安裝後初始密碼的位置不同),我記得之前安裝完之後初始密碼是保存在/root/.mysql_sercret 檔案中的。

如果你在安裝過程中發現、遇到了什麼問題,歡迎一起探討。

相關文章推薦:

mysql 5.7.12 win64手動安裝教學步驟(圖文)

mysql-5.7.12解壓縮版安裝步驟教學

以上是CentOS 6.5 下方安裝MySQL 5.7.12詳細步驟(圖文)的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!