1. 程式人生 > >CentOs中的Mysql 下載安裝

CentOs中的Mysql 下載安裝

Mysql 下載地址:http://dev.mysql.com/downloads/
二級選單中選擇Community,可以看到所有Mysql的版本,我們選擇MySQL Community Server 。
選擇對應版本後,進入下載頁面,看到了兩個大大的按鈕“Login”和“Sign Up”,嚇我一跳,我還以為下載Mysql還得註冊呢。然後不小心往下面掃了一眼,發現了這個連結“No thanks, just start my download.”。OK,點選下載!
下載完壓縮包mysql-5.7.10-1.el6.i686.rpm-bundle.tar,傳到centos上,然後解壓,發現解壓後有好多rpm安裝包:

mysql-community-client-5.7.10-1.el6.i686.rpm
mysql-community-common-5.7.10-1.el6.i686.rpm
mysql-community-devel-5.7.10-1.el6.i686.rpm
mysql-community-embedded-5.7.10-1.el6.i686.rpm
mysql-community-embedded-devel-5.7.10-1.el6.i686.rpm
mysql-community-libs-5.7.10-1.el6.i686.rpm
mysql-community-libs-compat
-5.7.10-1.el6.i686.rpm mysql-community-server-5.7.10-1.el6.i686.rpm mysql-community-test-5.7.10-1.el6.i686.rpm

我這裡只需要mysql-community-server-5.7.10-1.el6.i686.rpm,所以就只安裝這個包就行了(root使用者安裝):

# rpm -ivh mysql-community-server-5.7.10-1.el6.i686.rpm
warning: mysql-community-server-5.7.10-1.el6.i686.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1
f5: NOKEY error: Failed dependencies: mysql-community-client(x86-32) = 5.7.10-1.el6 is needed by mysql-community-server-5.7.10-1.el6.i686 mysql-community-common(x86-32) = 5.7.10-1.el6 is needed by mysql-community-server-5.7.10-1.el6.i686

納尼(⊙ˍ⊙)
好吧,依賴就依賴吧,聽你的:

# rpm -ivh mysql-community-client-5.7.10-1.el6.i686.rpm
warning: mysql-community-client-5.7.10-1.el6.i686.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        mysql-community-libs(x86-32) = 5.7.10-1.el6 is needed by mysql-community-client-5.7.10-1.el6.i686

還是缺少依賴包,折騰了一會才安裝完成了,安裝順序:
1. mysql-community-common-5.7.10-1.el6.i686.rpm
2. mysql-community-libs-5.7.10-1.el6.i686.rpm
3. mysql-community-client-5.7.10-1.el6.i686.rpm
4. mysql-community-server-5.7.10-1.el6.i686.rpm

安裝完成,檢查一下安裝包:

# rpm -qa | grep mysql    
mysql-community-server-5.7.10-1.el6.i686
mysql-community-libs-5.7.10-1.el6.i686
mysql-community-common-5.7.10-1.el6.i686
mysql-community-client-5.7.10-1.el6.i686

當然,yum也可以看到:

# yum list | grep mysql 
mysql-community-client.i686    5.7.10-1.el6         installed      
mysql-community-common.i686    5.7.10-1.el6         installed      
mysql-community-libs.i686      5.7.10-1.el6         installed      
mysql-community-server.i686    5.7.10-1.el6         installed      
apr-util-mysql.i686            1.3.9-3.el6_0.1      base           
bacula-director-mysql.i686     5.0.0-13.el6         base           
bacula-storage-mysql.i686      5.0.0-13.el6         base           
dovecot-mysql.i686             1:2.0.9-19.el6_7.2   updates        
freeradius-mysql.i686          2.2.6-6.el6_7        updates        
libdbi-dbd-mysql.i686          0.8.3-5.1.el6        base           
mod_auth_mysql.i686            1:3.0.0-11.el6_0.1   base           
mysql.i686                     5.1.73-5.el6_6       base           
mysql-bench.i686               5.1.73-5.el6_6       base           
mysql-connector-java.noarch    1:5.1.17-6.el6       base           
mysql-connector-odbc.i686      5.1.5r1144-7.el6     base           
mysql-devel.i686               5.1.73-5.el6_6       base           
mysql-embedded.i686            5.1.73-5.el6_6       base           
mysql-embedded-devel.i686      5.1.73-5.el6_6       base           
mysql-libs.i686                5.1.73-5.el6_6       base           
mysql-server.i686              5.1.73-5.el6_6       base           
mysql-test.i686                5.1.73-5.el6_6       base           
php-mysql.i686                 5.3.3-46.el6_6       updates        
qt-mysql.i686                  1:4.6.2-28.el6_5     base 

PS:安裝Mysql之前,我建立了Mysql使用者,並指定了主目錄為·/var/lib/mysql·,Mysql安裝完成後,自動指定了datadir=/var/lib/mysql:

-bash-4.1$ ls -l
-rw------- 1 mysql mysql 1675 Jan  2 00:47 ca-key.pem
-rw-r--r-- 1 mysql mysql 1074 Jan  2 00:47 ca.pem
-rw------- 1 mysql mysql 1675 Jan  2 00:47 server-key.pem
-rw-r--r-- 1 mysql mysql 1078 Jan  2 00:47 server-cert.pem
-rw------- 1 mysql mysql 1679 Jan  2 00:47 client-key.pem
-rw-r--r-- 1 mysql mysql 1078 Jan  2 00:47 client-cert.pem
-rw------- 1 mysql mysql 1679 Jan  2 00:47 private_key.pem
-rw-r--r-- 1 mysql mysql  451 Jan  2 00:47 public_key.pem

配置比較複雜,就寫在下一篇吧。