你的位置:首页 > 数据库

[数据库]linux下 yum源、rpm、源代码安装mysql


mysql的安装

一、yum源格式安装mysql

1、到官网下载mysql的yum源:

[root@localhost Downloads]# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

[root@localhost Downloads]# ls
mysql57-community-release-el6-7.noarch.rpm

2、列出rpm包中文件(查看哪些内容):

[root@localhost Downloads]# rpm -qpl mysql57-community-release-el6-7.noarch.rpm
warning: mysql57-community-release-el6-7.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
/etc/yum.repos.d/mysql-community-source.repo
/etc/yum.repos.d/mysql-community.repo

3、安装rpm包(自动配置好yum源):

[root@localhost Downloads]# rpm -ivh mysql57-community-release-el6-7.noarch.rpm
warning: mysql57-community-release-el6-7.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:mysql57-community-relea########################################### [100%]

4、安装mysql:

[root@localhost Downloads]# yum   install mysql

 5、启动mysql:

[root@localhost mysql]# /etc/init.d/mysql start
Starting MySQL........ [ OK ]

 

二、RPM方式安装mysql:

1.将下载好的文件上传到Linux下:

[root@localhost Downloads]# ls
MySQL-5.6.16-1.el6.x86_64.rpm-bundle.tar

2、解压tar文件:

[root@localhost Downloads]# tar -xf MySQL-5.6.16-1.el6.x86_64.rpm-bundle.tar

[root@localhost Downloads]# ls
MySQL-client-5.6.16-1.el6.x86_64.rpm
MySQL-devel-5.6.16-1.el6.x86_64.rpm
MySQL-embedded-5.6.16-1.el6.x86_64.rpm
MySQL-server-5.6.16-1.el6.x86_64.rpm
MySQL-shared-5.6.16-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.16-1.el6.x86_64.rpm
MySQL-test-5.6.16-1.el6.x86_64.rpm

3、安装rpm文件:

[root@localhost Downloads]# rpm -Uvh MySQL-*
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [ 14%]
2:MySQL-client ########################################### [ 29%]
3:MySQL-test ########################################### [ 43%]
4:MySQL-embedded ########################################### [ 57%]
5:MySQL-shared-compat ########################################### [ 71%]
6:MySQL-shared ########################################### [ 86%]
7:MySQL-server ########################################### [100%]

4、启动mysql服务:

[root@localhost mysql]# /etc/init.d/mysql start
Starting MySQL........ [ OK ]