一、查看CentOS自帶mysql是否已安裝。 輸入命令: [root@localhost ~]# yum list installed | grep mysql 返回信息以下: mysql.x86_64 5.1.73-3.el6_5 @base
mysql-devel.x86_64 5.1.73-3.el6_5 @base
mysql-libs.x86_64 5.1.73-3.el6_5 @base
mysql-server.x86_64 5.1.73-3.el6_5 @basejava
返回以上信息意思是本機已安裝了該版本的mysqlpython
二、如有自帶安裝的mysql,先卸載CentOS系統自帶mysql數據庫;如有多個依賴文件則依次卸載。 當結果顯示爲Complete!即卸載完畢。 輸入命令: [root@localhost ~]# yum -y remove mysql.x86_64 返回信息以下: Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.1.73-3.el6_5 will be erased --> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-devel-5.1.73-3.el6_5.x86_64 --> Running transaction check ---> Package mysql-devel.x86_64 0:5.1.73-3.el6_5 will be erased ---> Package mysql-server.x86_64 0:5.1.73-3.el6_5 will be erased --> Finished Dependency Resolutionmysql
Dependencies Resolvedsql
Removing: mysql x86_64 5.1.73-3.el6_5 @base 2.4 M Removing for dependencies: mysql-devel x86_64 5.1.73-3.el6_5 @base 388 k mysql-server x86_64 5.1.73-3.el6_5 @base 25 M數據庫
Remove 3 Package(s)centos
Installed size: 27 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : mysql-devel-5.1.73-3.el6_5.x86_64 1/3 Erasing : mysql-server-5.1.73-3.el6_5.x86_64 2/3 Erasing : mysql-5.1.73-3.el6_5.x86_64 3/3 Verifying : mysql-devel-5.1.73-3.el6_5.x86_64 1/3 Verifying : mysql-server-5.1.73-3.el6_5.x86_64 2/3 Verifying : mysql-5.1.73-3.el6_5.x86_64 3/3網絡
Removed: mysql.x86_64 0:5.1.73-3.el6_5ui
Dependency Removed: mysql-devel.x86_64 0:5.1.73-3.el6_5 mysql-server.x86_64 0:5.1.73-3.el6_5debug
Complete!server
輸入命令: [root@localhost ~]# yum -y remove mysql-libs.x86_64 返回信息以下: Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be erased --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64 --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64 --> Running transaction check ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased --> Finished Dependency Resolution
Dependencies Resolved
Removing: mysql-libs x86_64 5.1.73-3.el6_5 @base 4.0 M Removing for dependencies: perl-DBD-MySQL x86_64 4.013-3.el6 @base 338 k
Remove 2 Package(s)
Installed size: 4.4 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : perl-DBD-MySQL-4.013-3.el6.x86_64 1/2 Erasing : mysql-libs-5.1.73-3.el6_5.x86_64 2/2 Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 1/2 Verifying : mysql-libs-5.1.73-3.el6_5.x86_64 2/2
Removed: mysql-libs.x86_64 0:5.1.73-3.el6_5
Dependency Removed: perl-DBD-MySQL.x86_64 0:4.013-3.el6
Complete!
再輸入命令: [root@localhost ~]# yum list installed | grep mysql 沒有返回信息,即表示已經完成卸載了。
三、查看yum庫上的mysql版本信息(CentOS系統須要正常鏈接網絡)。 輸入命令: [root@localhost ~]# yum -y list mysql* 返回信息以下: Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile
四、使用yum安裝mysql數據庫。 輸入:yum -y install mysql-server mysql mysql-devel ,命令將:mysql-server、mysql、mysql-devel都安裝好,當結果顯示爲「Complete!」即安裝完畢。 注:安裝mysql只是安裝了數據庫,只有安裝mysql-server才至關於安裝了客戶端。
輸入命令: [root@localhost ~]# yum -y install mysql-server mysql mysql-devel 返回信息以下: Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile
Dependencies Resolved
Installing: mysql x86_64 5.1.73-3.el6_5 base 894 k mysql-devel x86_64 5.1.73-3.el6_5 base 129 k mysql-server x86_64 5.1.73-3.el6_5 base 8.6 M Installing for dependencies: mysql-libs x86_64 5.1.73-3.el6_5 base 1.2 M perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k
Install 5 Package(s)
Total 144 kB/s | 11 MB 01:18
Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql-libs-5.1.73-3.el6_5.x86_64 1/5 Installing : mysql-5.1.73-3.el6_5.x86_64 2/5 Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 3/5 Installing : mysql-server-5.1.73-3.el6_5.x86_64 4/5 Installing : mysql-devel-5.1.73-3.el6_5.x86_64 5/5 Verifying : mysql-devel-5.1.73-3.el6_5.x86_64 1/5 Verifying : mysql-libs-5.1.73-3.el6_5.x86_64 2/5 Verifying : mysql-server-5.1.73-3.el6_5.x86_64 3/5 Verifying : mysql-5.1.73-3.el6_5.x86_64 4/5 Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 5/5
Installed: mysql.x86_64 0:5.1.73-3.el6_5 mysql-devel.x86_64 0:5.1.73-3.el6_5
mysql-server.x86_64 0:5.1.73-3.el6_5
Dependency Installed: mysql-libs.x86_64 0:5.1.73-3.el6_5 perl-DBD-MySQL.x86_64 0:4.013-3.el6
Complete!
五、查看剛安裝mysql數據庫版本信息。 輸入命令: [root@localhost ~]# rpm -qi mysql-server 返回信息以下: Name : mysql-server Relocations: (not relocatable) Version : 5.1.73 Vendor: CentOS Release : 3.el6_5 Build Date: Thu 13 Feb 2014 03:42:39 AM CST Install Date: Tue 05 May 2015 10:06:02 AM CST Build Host: c6b9.bsys.dev.centos.org Group : Applications/Databases Source RPM: mysql-5.1.73-3.el6_5.src.rpm Size : 25882723 License: GPLv2 with exceptions Signature : RSA/SHA1, Thu 13 Feb 2014 03:48:08 AM CST, Key ID 0946fca2c105b9de Packager : CentOS BuildSystem http://bugs.centos.org URL : http://www.mysql.com Summary : The MySQL server and related files Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a client/server implementation consisting of a server daemon (mysqld) and many different client programs and libraries. This package contains the MySQL server and some accompanying files and directories.