1.查看数据库中已安装的版本:

[mdata@bogon ~]$ yum list installed|grep mysql
mysql-libs.x86_64 5.1.71-1.el6 @anaconda-CentOS-201311272149.x86_64/6.5

2.移除数据库中已有的版本:
[root@bogon mdata]# yum -y remove mysql-libs.x86_64
...

Complete!

3.下载mysql数据库安装包:

[root@bogon mdata]# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
--2018-04-12 03:07:43-- http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
Resolving repo.mysql.com... 23.55.208.125
Connecting to repo.mysql.com|23.55.208.125|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5824 (5.7K) [application/x-redhat-package-manager]
Saving to: “mysql-community-release-el6-5.noarch.rpm”

100%[======================================>] 5,824 11.7K/s in 0.5s

2018-04-12 03:07:43 (11.7 KB/s) - “mysql-community-release-el6-5.noarch.rpm” saved [5824/5824]

4.解压压缩包:

[root@bogon mdata]# rpm -ivh mysql-community-release-el6-5.noarch.rpm
Preparing... ########################################### [100%]
1:mysql-community-release########################################### [100%]

5.查看解压结果:
[root@bogon mdata]# yum repolist all|grep mysql
mysql-connectors-community MySQL Connectors Community enabled: 45
mysql-connectors-community-source MySQL Connectors Community - So disabled
mysql-tools-community MySQL Tools Community enabled: 57
mysql-tools-community-source MySQL Tools Community - Source disabled
mysql55-community MySQL 5.5 Community Server disabled
mysql55-community-source MySQL 5.5 Community Server - So disabled
mysql56-community MySQL 5.6 Community Server enabled: 415
mysql56-community-source MySQL 5.6 Community Server - So disabled
mysql57-community-dmr MySQL 5.7 Community Server Deve disabled
mysql57-community-dmr-source MySQL 5.7 Community Server Deve disabled

6.安装mysql数据库:
[root@bogon mdata]# yum install mysql-community-server -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.39-2.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.39-2.el6 for package: mysql-community-server-5.6.39-2.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.39-2.el6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.39-2.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.39-2.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.39-2.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.6.39-2.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.39-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mysql-community-server x86_64 5.6.39-2.el6 mysql56-community 55 M
Installing for dependencies:
mysql-community-client x86_64 5.6.39-2.el6 mysql56-community 18 M
mysql-community-common x86_64 5.6.39-2.el6 mysql56-community 308 k
mysql-community-libs x86_64 5.6.39-2.el6 mysql56-community 1.9 M
perl-DBI x86_64 1.609-4.el6 base 705 k

Transaction Summary
================================================================================
Install 5 Package(s)

Total download size: 75 M
Installed size: 337 M
Downloading Packages:
(1/5): mysql-community-client-5.6.39-2.el6.x86_64.rpm | 18 MB 13:18 
(2/5): mysql-community-common-5.6.39-2.el6.x86_64.rpm | 308 kB 00:15 
(3/5): mysql-community-libs-5.6.39-2.el6.x86_64.rpm | 1.9 MB 01:19 
(4/5): mysql-community-server-5.6.39-2.el6.x86_64.rpm | 55 MB 42:12 
(5/5): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:01 
--------------------------------------------------------------------------------
Total 22 kB/s | 75 MB 57:08 
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
Package: mysql-community-release-el6-5.noarch (installed)
From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : mysql-community-common-5.6.39-2.el6.x86_64 1/5 
Installing : mysql-community-libs-5.6.39-2.el6.x86_64 2/5 
Installing : mysql-community-client-5.6.39-2.el6.x86_64 3/5 
Installing : perl-DBI-1.609-4.el6.x86_64 4/5 
Installing : mysql-community-server-5.6.39-2.el6.x86_64 5/5 
Verifying : mysql-community-server-5.6.39-2.el6.x86_64 1/5 
Verifying : mysql-community-libs-5.6.39-2.el6.x86_64 2/5 
Verifying : mysql-community-client-5.6.39-2.el6.x86_64 3/5 
Verifying : mysql-community-common-5.6.39-2.el6.x86_64 4/5 
Verifying : perl-DBI-1.609-4.el6.x86_64 5/5

Installed:
mysql-community-server.x86_64 0:5.6.39-2.el6

Dependency Installed:
mysql-community-client.x86_64 0:5.6.39-2.el6 
mysql-community-common.x86_64 0:5.6.39-2.el6 
mysql-community-libs.x86_64 0:5.6.39-2.el6 
perl-DBI.x86_64 0:1.609-4.el6

Complete!

7.查看已安装的数据库版本:
[root@bogon mdata]# yum list installed|grep mysql
mysql-community-client.x86_64
5.6.39-2.el6 @mysql56-community 
mysql-community-common.x86_64
5.6.39-2.el6 @mysql56-community 
mysql-community-libs.x86_64
5.6.39-2.el6 @mysql56-community 
mysql-community-release.noarch
mysql-community-server.x86_64
5.6.39-2.el6 @mysql56-community

8.添加开机启动项:
[root@bogon mdata]# chkconfig --list|grep mysqld
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@bogon mdata]# chkconfig mysql on
error reading information on service mysql: No such file or directory
[root@bogon mdata]# chkconfig mysqld on

9.启动mysql服务器:
[root@bogon mdata]# service mysqld start
Initializing MySQL database: 2018-04-12 05:38:48 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-12 05:38:48 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-04-12 05:38:48 0 [Note] /usr/sbin/mysqld (mysqld 5.6.39) starting as process 18488 ...
2018-04-12 05:38:48 18488 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-04-12 05:38:48 18488 [Note] InnoDB: The InnoDB memory heap is disabled
2018-04-12 05:38:48 18488 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-12 05:38:48 18488 [Note] InnoDB: Memory barrier is not used
2018-04-12 05:38:48 18488 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-04-12 05:38:48 18488 [Note] InnoDB: Using Linux native AIO
2018-04-12 05:38:48 18488 [Note] InnoDB: Using CPU crc32 instructions
2018-04-12 05:38:48 18488 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-04-12 05:38:48 18488 [Note] InnoDB: Completed initialization of buffer pool
2018-04-12 05:38:48 18488 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2018-04-12 05:38:48 18488 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-04-12 05:38:48 18488 [Note] InnoDB: Database physically writes the file full: wait...
2018-04-12 05:38:48 18488 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-04-12 05:38:48 18488 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-04-12 05:38:49 18488 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-04-12 05:38:49 18488 [Warning] InnoDB: New log files created, LSN=45781
2018-04-12 05:38:49 18488 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-04-12 05:38:49 18488 [Note] InnoDB: Doublewrite buffer created
2018-04-12 05:38:49 18488 [Note] InnoDB: 128 rollback segment(s) are active.
2018-04-12 05:38:49 18488 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-12 05:38:49 18488 [Note] InnoDB: Foreign key constraint system tables created
2018-04-12 05:38:49 18488 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-04-12 05:38:49 18488 [Note] InnoDB: Tablespace and datafile system tables created.
2018-04-12 05:38:49 18488 [Note] InnoDB: Waiting for purge to start
2018-04-12 05:38:49 18488 [Note] InnoDB: 5.6.39 started; log sequence number 0
2018-04-12 05:38:49 18488 [Note] Binlog end
2018-04-12 05:38:49 18488 [Note] InnoDB: FTS optimize thread exiting.
2018-04-12 05:38:49 18488 [Note] InnoDB: Starting shutdown...
2018-04-12 05:38:51 18488 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2018-04-12 05:38:51 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-12 05:38:51 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-04-12 05:38:51 0 [Note] /usr/sbin/mysqld (mysqld 5.6.39) starting as process 18510 ...
2018-04-12 05:38:51 18510 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-04-12 05:38:51 18510 [Note] InnoDB: The InnoDB memory heap is disabled
2018-04-12 05:38:51 18510 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-12 05:38:51 18510 [Note] InnoDB: Memory barrier is not used
2018-04-12 05:38:51 18510 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-04-12 05:38:51 18510 [Note] InnoDB: Using Linux native AIO
2018-04-12 05:38:51 18510 [Note] InnoDB: Using CPU crc32 instructions
2018-04-12 05:38:51 18510 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-04-12 05:38:51 18510 [Note] InnoDB: Completed initialization of buffer pool
2018-04-12 05:38:51 18510 [Note] InnoDB: Highest supported file format is Barracuda.
2018-04-12 05:38:51 18510 [Note] InnoDB: 128 rollback segment(s) are active.
2018-04-12 05:38:51 18510 [Note] InnoDB: Waiting for purge to start
2018-04-12 05:38:51 18510 [Note] InnoDB: 5.6.39 started; log sequence number 1625977
2018-04-12 05:38:51 18510 [Note] Binlog end
2018-04-12 05:38:51 18510 [Note] InnoDB: FTS optimize thread exiting.
2018-04-12 05:38:51 18510 [Note] InnoDB: Starting shutdown...
2018-04-12 05:38:53 18510 [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 bogon 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

[ OK ]
Starting mysqld: [ OK ]

10.mysql数据库安全设置(密码设置):

[root@bogon mdata]# 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): 
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
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] n
... skipping.

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] y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!

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...

11.授权远程登录:
[root@bogon mdata]# mysql -uroot -p密码

mysql> grant all privileges on *.* to 'root'@'%' identified by 'mdata2018' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

12.关闭防火墙:

service iptables stop

CentOS6.5系统,mysql数据库的安装的更多相关文章

  1. [转] Linux学习之CentOS(十三)--CentOS6.4下Mysql数据库的安装与配置

    from:  http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 如果要在Linux上做j2ee开发,首先得 ...

  2. Linux学习之CentOS(十三)--CentOS6.4下Mysql数据库的安装与配置

    原文:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 如果要在Linux上做j2ee开发,首先得搭建好j ...

  3. CentOS6.4下Mysql数据库的安装与配置

    原文连接:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 说到数据库,我们大多想到的是关系型数据库,比如 ...

  4. Linux学习之CentOS(十三)--CentOS6.4下Mysql数据库的安装与配置(转)

    原文地址:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 如果要在Linux上做j2ee开发,首先得搭建 ...

  5. Linux学习之CentOS(一)--CentOS6.6下Mysql数据库的安装与配置

    在这里我是通过yum来进行mysql数据库的安装的,通过这种方式进行安装,可以将跟mysql相关的一些服务.jar包都给我们安装好,所以省去了很多不必要的麻烦!!! [root@larry ~]# c ...

  6. Linux CentOS6.4下Mysql数据库的安装与配置

    一.mysql简介 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库,咱 ...

  7. CentOS6.5下Mysql数据库的安装与配置

    一.mysql简介 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库,咱 ...

  8. CentOS6.4下Mysql数据库的安装与配置,导入数据库,授权远程ip

    卸载掉原有mysql 由于mysql数据库在Linux上实在是太流行了,所以眼下下载的主流Linux系统版本号基本上都集成了mysql数据库在里面,我们能够通过例如以下命令来查看我们的操作系统上是否已 ...

  9. 00-Windows系统MySQL数据库的安装

    1.数据库安装 官网下载MySQL数据库. 下载安装包后解压缩到相关目录,我解压缩到:D:\360极速浏览器下载\mysql-8.0.19-winx64. 打开刚刚解压的文件夹 D:\360极速浏览器 ...

  10. linux学习之centos(三):mysql数据库的安装和配置

    前言:mysql简介 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库, ...

随机推荐

  1. 【转】Yelp是如何实现每天运行数百万个测试的

    Yelp每天要运行数百万个测试,确保开发人员提交的代码不会对已有的功能造成破坏.如此巨大规模的测试,他们是怎么做到的呢?以下内容翻译自 Yelp 的技术博客,并已获得翻译授权,查看原文 How Yel ...

  2. windows下设置PHP环境变量

    1.找到“高级系统设置”(二选一的方法找到环境变量) ① 我的电脑-属性-高级-环境变量 ②win8,10 直接在搜索框搜 “查看高级系统设置”-环境变量 2.找到变量"Path" ...

  3. C++学习 —— 住着魔鬼的细节

    13周的C++课程转眼就学完了5周,C++的标准基本上已经覆盖到了.再加上coding了上百行,总算是对C++有了一个基本的了解.接下来的学习会是关于STL的,所以在此对目前所学做一个小的总结. th ...

  4. Linux下查看设设置时间date命令

    查看时间 # date "+%Y_%m_%d  %H-%M-%S" 设置时间 #date -s "2018-05-17 09:51:50" //写入到硬件时钟 ...

  5. python处理u开头的字符串

    是用python处理excel过程中,从表格中解析除字符串,打印出来的中文却显示成了u'开头的乱码字符串,在控制台中输出的编码格式是utf-8,而excel表格的数据也是utf-8编码成的,但是解析成 ...

  6. php操作redis案例

    <?php     //实例化     $redis = new Redis();     //连接服务器     //默认端口是6379,可不写     $redis->connect( ...

  7. DCL并非单例模式专用

    我相信大家都很熟悉DCL,对于缺少实践经验的程序开发人员来说,DCL的学习基本限制在单例模式,但我发现在高并发场景中会经常遇到需要用到DCL的场景,但并非用做单例模式,其实DCL的核心思想和CopyO ...

  8. NYOJ - 矩形嵌套(经典dp)

    矩形嵌套时间限制:3000 ms | 内存限制:65535 KB 描述 有n个矩形,每个矩形可以用a,b来描述,表示长和宽.矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b< ...

  9. 做二级菜单时候遇到的关于事件冒泡以及mouseover和mouseenter的不同

    二级菜单作为最普通小组件,我遇到了坑. <style> .wrapper { height: 150px; border: 1px solid; width: 150px; } .wrap ...

  10. C/C++预处理器

    关于预处理器 首先时预处理器的条件指令 什么是预处理指令? 预处理指令是以#号开头的代码行.#号必须是该行除了任何空白字符外的第一个字符.#后是指令关键字,在关键字和#号之间允许存在任意个数的空白字符 ...