>데이터 베이스 >MySQL 튜토리얼 >CentOS 6.5安装MySQL 5.6

CentOS 6.5安装MySQL 5.6

WBOY
WBOY원래의
2016-06-07 15:10:091046검색

说明:CentOS 6.5安装MySQL 5.6 1. 先查看版本号# uname -a或 # cat /etc/RedHat-release CentOS release 6.6 (Final)2. 下载并安

说明:CentOS 6.5安装MySQL 5.6

1. 先查看版本号
# uname -a

# cat /etc/RedHat-release
CentOS release 6.6 (Final)
2. 下载并安装Mysql的yum仓库
下载Mysql的yum仓库

然后安装一下这个仓库列表

$ sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
3. 搜索可安装的mysql版本
执行这个命令后就能看到可安装的mysql:

# yum repolist enabled | grep "mysql.*-community.*"
如果我们是要安装最新的版本,那么可以直接执行

# sudo yum install mysql-community-server
如果我们要选择版本,可以先执行下面这个命令查看一下有哪些版本:

# yum repolist all | grep mysql
如果要选择版本的话,有两种方式,一种是使用命令来

$ sudo yum-config-manager --disable mysql56-community
$ sudo yum-config-manager --enable mysql57-community-dmr
这个命令就是在仓库中启用5.7版本的,禁用5.6版本子仓库
或者编辑/etc/yum.repos.d/mysql-community.repo文件

# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
enabled=0表示禁用
比如要安装5.7版本的mysql,要确定5.6的enabled=0,5.7的enabled=1,一次保证只启用一个子仓库

# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
然后我们又可以愉快的安装mysql了

$ sudo yum install mysql-community-server
安装完成后我们启动mysql

$ sudo service mysqld start
查看mysql状态

$ sudo service mysqld status
启动mysql服务并初始化:

# /etc/init.d/mysqld start
Initializing MySQL database:
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iZ94vana2fdZ password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at

[ OK ]
Starting mysqld: [ OK ]
4. 相关命令
启动mysql服务

# service mysqld start
重启mysql服务

# service mysqld restart
停止mysql服务

# service mysqld stop

以下是小编为您精心挑选的MySQL相关内容,,看看是否有所帮助:

Linux下安装编译MySQL5.5.28 

Linux下MySQL 5.6.23安装 

CentOS 7下源码安装MySQL 5.6 

MySQL5.7.3.0安装配置图解教程

Ubuntu 14.04下安装MySQL

《MySQL权威指南(原书第2版)》清晰中文扫描版 PDF

Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

Ubuntu 14.04下搭建MySQL主从服务器

Ubuntu 12.04 LTS 构建高可用分布式 MySQL 集群

Ubuntu 12.04下源代码安装MySQL5.6以及Python-MySQLdb

MySQL-5.5.38通用二进制安装

本文永久更新链接地址

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
이전 기사:mysql格式化小数다음 기사:简析OpenGL的2D、3D切换