CentOS使用yum安装mysql
CentOS使用yum安装mysql
罗荣熙 发表于3年前
CentOS使用yum安装mysql
  • 发表于 3年前
  • 阅读 324
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

摘要: CentOS使用yum安装mysql,我再这里整理一下,仅供初学者参考使用,大牛就用不着了O(∩_∩)O~。

1、查看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 @base

返回以上信息意思是本机已安装了该版本的mysql

2、若有自带安装的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 Resolution

Dependencies Resolved

================================================================================ Package Arch Version Repository Size

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

Transaction Summary

Remove 3 Package(s)

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_5

Dependency Removed: mysql-devel.x86_64 0:5.1.73-3.el6_5 mysql-server.x86_64 0:5.1.73-3.el6_5

Complete!

输入命令: [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

================================================================================ Package Arch Version Repository Size

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

Transaction Summary

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 没有返回信息,即表示已经完成卸载了。

3、查看yum库上的mysql版本信息(CentOS系统需要正常连接网络)。 输入命令: [root@localhost ~]# yum -y list mysql* 返回信息如下: Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile

  • base: mirrors.zju.edu.cn
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com Available Packages MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 base mysql.x86_64 5.1.73-3.el6_5 base mysql-bench.x86_64 5.1.73-3.el6_5 base mysql-connector-java.noarch 1:5.1.17-6.el6 base mysql-connector-odbc.x86_64 5.1.5r1144-7.el6 base mysql-devel.i686 5.1.73-3.el6_5 base mysql-devel.x86_64 5.1.73-3.el6_5 base mysql-embedded.i686 5.1.73-3.el6_5 base mysql-embedded.x86_64 5.1.73-3.el6_5 base mysql-embedded-devel.i686 5.1.73-3.el6_5 base mysql-embedded-devel.x86_64 5.1.73-3.el6_5 base mysql-libs.i686 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 base mysql-test.x86_64 5.1.73-3.el6_5 base

4、使用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

  • base: mirrors.zju.edu.cn
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.1.73-3.el6_5 will be installed --> Processing Dependency: mysql-libs = 5.1.73-3.el6_5 for package: mysql-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: mysql-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: mysql-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-5.1.73-3.el6_5.x86_64 ---> Package mysql-devel.x86_64 0:5.1.73-3.el6_5 will be installed ---> Package mysql-server.x86_64 0:5.1.73-3.el6_5 will be installed --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Running transaction check ---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be installed ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed --> Finished Dependency Resolution

Dependencies Resolved

================================================================================ Package Arch Version Repository Size

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

Transaction Summary

Install 5 Package(s)

Total download size: 11 M Installed size: 32 M Downloading Packages: (1/5): mysql-5.1.73-3.el6_5.x86_64.rpm | 894 kB 00:04
(2/5): mysql-devel-5.1.73-3.el6_5.x86_64.rpm | 129 kB 00:00
(3/5): mysql-libs-5.1.73-3.el6_5.x86_64.rpm | 1.2 MB 00:07
(4/5): mysql-server-5.1.73-3.el6_5.x86_64.rpm | 8.6 MB 01:04
(5/5): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00

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!

5、查看刚安装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.

共有 人打赏支持
粉丝 26
博文 118
码字总数 84709
×
罗荣熙
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: