centos6.5 yum安装MySQL5.6

  • 创建MySQL用户
#useradd mysql
#passwd mysql
#chmod u+w /etc/sudoers
#vi /etc/sudoers
mysql ALL=(ALL) ALL
  • 安装仓库

要使用yum 安装mysql,要使用mysql的yum仓库,先从官网下载适合你系统的仓库
http://dev.mysql.com/downloads/repo/yum/
然后安装一下这个仓库列表

# sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
或:
# yum install http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm
  • 选择版本

查看可安装的mysql版本

[[email protected]1 ~]$ yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community MySQL Connectors Community 21
mysql-tools-community MySQL Tools Community 35
mysql57-community MySQL 5.7 Community Server 82

如果我们要选择版本,可以先执行下面这个命令查看一下有哪些版本

[[email protected]1 ~]$ yum repolist all | grep mysql

选择版本,启用5.6版本的,禁用5.7版本子仓库

[[email protected]1 ~]$ sudo yum-config-manager --enable mysql56-community
[[email protected]-1 ~]$ sudo yum-config-manager --disable mysql57-community

或者
编辑/etc/yum.repos.d/mysql-community.repo文件
enabled=0 表示禁用
比如要安装5.7版本的mysql,要确定5.6的enabled=0,5.7的enabled=1,一次保证只启用一个子仓库

查看可安装的mysql版本

[[email protected]1 ~]$ yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community MySQL Connectors Community 21
mysql-tools-community MySQL Tools Community 35
mysql56-community MySQL 5.6 Community Server 248
  • 安装
[[email protected]1 ~]$ sudo yum install mysql-community-server
  • 启动数据库

[[email protected]1 mysql]# service mysqld strat
用法:/etc/init.d/mysqld {start|stop|status|restart|condrestart|try-restart|reload|force-reload}
[[email protected]-1 mysql]# service mysqld start
初始化 MySQL 数据库: 2016-05-11 10:15:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-11 10:15:01 0 [Note] /usr/sbin/mysqld (mysqld 5.6.30) starting as process 2843 ...
2016-05-11 10:15:01 2843 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-05-11 10:15:01 2843 [Note] InnoDB: The InnoDB memory heap is disabled
2016-05-11 10:15:01 2843 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-11 10:15:01 2843 [Note] InnoDB: Memory barrier is not used
2016-05-11 10:15:01 2843 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-05-11 10:15:01 2843 [Note] InnoDB: Using Linux native AIO
2016-05-11 10:15:01 2843 [Note] InnoDB: Using CPU crc32 instructions
2016-05-11 10:15:01 2843 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-05-11 10:15:01 2843 [Note] InnoDB: Completed initialization of buffer pool
2016-05-11 10:15:01 2843 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-05-11 10:15:01 2843 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-05-11 10:15:01 2843 [Note] InnoDB: Database physically writes the file full: wait...
2016-05-11 10:15:01 2843 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-05-11 10:15:01 2843 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-05-11 10:15:02 2843 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-05-11 10:15:02 2843 [Warning] InnoDB: New log files created, LSN=45781
2016-05-11 10:15:02 2843 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-05-11 10:15:02 2843 [Note] InnoDB: Doublewrite buffer created
2016-05-11 10:15:02 2843 [Note] InnoDB: 128 rollback segment(s) are active.
2016-05-11 10:15:02 2843 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-05-11 10:15:02 2843 [Note] InnoDB: Foreign key constraint system tables created
2016-05-11 10:15:02 2843 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-05-11 10:15:02 2843 [Note] InnoDB: Tablespace and datafile system tables created.
2016-05-11 10:15:02 2843 [Note] InnoDB: Waiting for purge to start
2016-05-11 10:15:02 2843 [Note] InnoDB: 5.6.30 started; log sequence number 0
2016-05-11 10:15:03 2843 [Note] Binlog end
2016-05-11 10:15:03 2843 [Note] InnoDB: FTS optimize thread exiting.
2016-05-11 10:15:03 2843 [Note] InnoDB: Starting shutdown...
2016-05-11 10:15:05 2843 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2016-05-11 10:15:05 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-11 10:15:05 0 [Note] /usr/sbin/mysqld (mysqld 5.6.30) starting as process 2866 ...
2016-05-11 10:15:05 2866 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-05-11 10:15:05 2866 [Note] InnoDB: The InnoDB memory heap is disabled
2016-05-11 10:15:05 2866 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-11 10:15:05 2866 [Note] InnoDB: Memory barrier is not used
2016-05-11 10:15:05 2866 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-05-11 10:15:05 2866 [Note] InnoDB: Using Linux native AIO
2016-05-11 10:15:05 2866 [Note] InnoDB: Using CPU crc32 instructions
2016-05-11 10:15:05 2866 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-05-11 10:15:05 2866 [Note] InnoDB: Completed initialization of buffer pool
2016-05-11 10:15:05 2866 [Note] InnoDB: Highest supported file format is Barracuda.
2016-05-11 10:15:05 2866 [Note] InnoDB: 128 rollback segment(s) are active.
2016-05-11 10:15:05 2866 [Note] InnoDB: Waiting for purge to start
2016-05-11 10:15:05 2866 [Note] InnoDB: 5.6.30 started; log sequence number 1625977
2016-05-11 10:15:06 2866 [Note] Binlog end
2016-05-11 10:15:06 2866 [Note] InnoDB: FTS optimize thread exiting.
2016-05-11 10:15:06 2866 [Note] InnoDB: Starting shutdown...
2016-05-11 10:15:07 2866 [Note] InnoDB: Shutdown completed; log sequence number 1625987

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 mysql-1 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 http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Note: new default config file not created.
Please make sure your config file is current

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

                                                           [确定]
正在启动 mysqld:                                          [确定]

  • 安全配置

[[email protected]1 mysql]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we‘ll need the current
password for the root user.  If you‘ve just installed MySQL, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):    ----输入root密码(默认为空):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y             ----是否要修改root密码:
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from ‘localhost‘.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named ‘test‘ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

All done!  If you‘ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...
[[email protected]-1 mysql]# 

[[email protected]1 mysql]#  service mysqld status
mysqld (pid  3097) 正在运行...
时间: 2024-10-15 16:40:42

centos6.5 yum安装MySQL5.6的相关文章

CentOS6.5 yum安装mysql5.7.18

由于最近工作要做MySQL集群,所以需要安装MySQL,本机可以联网,如不能联网可参看rpm安装方法,废话不多,具体安装步骤如下: 1,下载MySQL wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm 2,安装到本地yum源 yum localinstall mysql57-community-release-el6-11.noarch.rpm 3,安装MySQL yum install mysql

centos6.x yum 安装 mysql5.6 mysql5.7

先卸载低版本MYSQL yum remove mysql* rpm -ivh http://repo.mysql.com/mysql-community-release-el6.rpm yum install mysql-server 安装成功以后 service mysqld restart 如果是全新安装MYSQL会自己初始化数据库,启动成功以后运行修改ROOT密码命令 mysqladmin -u root password 'new-password' 如果是升级安装的话,就要运行升级数据

CentOS6.8 yum 安装 mysql5.7.12 完美步骤

一,wget http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm 二,yum localinstall mysql57-community-release-el6-8.noarch.rpm 三,yum install mysql-server 四,mysqld --initialize --user=mysql 五,找到密码 vi /var/log/mysqld.log 六,修改密码 mysqladmin -ur

Centos6.5使用yum安装Mysql5.7

想要玩新的东东就要付出代价,我的时间悄悄的都溜走了,说多了都是泪! 实践才是真理! 系统版本:Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux 1.下载Mysql5.7依赖源,并进行安装 wget http://dev.mysql.com/get/mysql57-community-release-el6-7.no

在centos6.5中安装mysql5.7

简介 博主最近在研究mysql的读写分离和主从复制,一台master和两台slave,三台机器在同一个局域网中,首先就就要在centos6.5中安装mysql5.7.好了,废话不多说,接下来进入正题. 一.解压缩到/usr/local/下面,mysql的主目录命名为mysql [[email protected] local]# cd /usr/local/soft/ [[email protected] soft]# tar zvxf mysql-5.7.10-linux-glibc2.5-i

centos6.7编译安装mysql5.7.17

centos6.7编译安装mysql5.7.17 2017-03-24 09:57:15 提示:mysql5.7.17和之前5.56以前的版本安装不一样,需要用cmake 另外,看本文档的mysql编译前我说一点,第一次一定要大概的看完整个过程,不能一直跟着文档做,否则后面容易遇到问题.比如编译完会特别占用磁盘空间,万一之前分配的空间不够,那样就会丢失很多重要文件导致失败. 安装前工作: 1,从官方网址下载MySQL5.7.17源码包 http://dev.MySQL.com/downloads

centos6.5编译安装mysql5.6.20

一.   准备工作 1     yum安装各个依赖包 [[email protected] ~]# yum –y install gcc gcc-devel gcc-c++ gcc-c++-devel  zlib*  ncurses-devel ncurses openssl openssl-devel bison bison-devel libaio [[email protected] ~]# yum –y install cmake 2.新建mysql组和用户 [[email protec

centos6.5 rpm安装mysql5.6.19

1,检查MySQL及相关RPM包,是否安装,如果有安装,则移除. rpm -qa | grep -i mysql yum -y remove mysql-libs* 2,根据系统下载RPM包,我下载的MySQL-5.6.19-1.el6.i686.rpm-bundle.tar 解压压缩包,依次安装: rpm -ivh MySQL-server-5.6.19-1.el6.i686.rpm rpm -ivh MySQL-devel-5.6.19-1.el6.i686.rpm rpm -ivh MyS

centos6.5 rpm安装mysql5.6.19操作及步骤

系统:centos 6.5  64位 数据库:mysql5.6.19 64位 采用RPM安装包安装,之后修改mysql默认路径. 首先要卸载系统自带mysql包,命令如下 yum remove mysql mysql-server mysql-libs 检查是否有残留 rpm -qa | grep mysql 若发现有则使用rpm -e 安装包名称 安装步骤: 1.官网下载tar压缩包,下载地址为http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-5.6