CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了CentOS 6.6上安装MySQL 5.6大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

1、首先第一步是安装好CentOS 6.6 先下载好centos 6.6,然后,在虚拟机中安装好系统。 需要安装vmware tools,由于VMware Tools这个目录中包含了空格,所以要用 \ 来转义空格: [root@ggg1 Desktop]# cd /media/VMware\ Tools [root@ggg1 Desktop]# tar -zvxf VMwareTools-9.2

1、首先第一步是安装好CentOS 6.6

先下载好centos 6.6,然后,在虚拟机中安装好系统。

需要安装vmware tools,由于VMware Tools这个目录中包含了空格,所以要用 \ 来转义空格:

[root@ggg1 Desktop]# cd /media/VMware\ Tools

[root@ggg1 Desktop]# tar -zvxf VMwareTools-9.2.0-799703.tar.gz -C /root/Desktop

安装后,就可以从LInux中复制粘贴。


2、下载MysqL 5.6

MysqL下载地址是在 网页 http://downloads.MysqL.com/archives/community/ 中,我选择了MysqL 5.6.12版,具体的rpm包是:MysqL-server-5.6.12-2.el6.x86_64.rpm。

通过wget命令来下载,指定的下载地址是:http://dev.MysqL.com/get/Downloads/mysql-5.6/MysqL-server-5.6.12-2.el6.x86_64.rpm

[root@wc1 Desktop]# wget http://dev.MysqL.com/get/Downloads/mysql-5.6/MysqL-server-5.6.12-2.el6.x86_64.rpm
--2016-08-16 11:34:47--  http://dev.MysqL.com/get/Downloads/mysql-5.6/MysqL-server-5.6.12-2.el6.x86_64.rpm
Resolving dev.MysqL.com... 137.254.60.11
ConnecTing to dev.MysqL.com|137.254.60.11|:80... connected.
http request sent,awaiTing response... 302 Found
LOCATIOn: http://cdn.MysqL.com//archives/mysql-5.6/MysqL-server-5.6.12-2.el6.x86_64.rpm [following]
--2016-08-16 11:34:49--  http://cdn.MysqL.com//archives/mysql-5.6/MysqL-server-5.6.12-2.el6.x86_64.rpm
Resolving cdn.MysqL.com... 104.102.164.25
ConnecTing to cdn.MysqL.com|104.102.164.25|:80... connected.
http request sent,awaiTing response... 200 OK
Length: 57355800 (55M) [application/x-redhat-package-manager]
Saving to: “MysqL-server-5.6.12-2.el6.x86_64.rpm”


100%[======================================>] 57,355,800   645K/s   in 3m 25s  


2016-08-16 11:38:15 (273 KB/s) - “MysqL-server-5.6.12-2.el6.x86_64.rpm” saved [57355800/57355800]

3、安装MysqL

运行如下命令来安装,但是并没有安装,显示有冲突,从字面的意思看出,大致上是我要安装的rpm包,和之前的MysqL-libs-5.1.73-3.el6_5.x86_64 有冲突:

[root@wc1 Desktop]# rpm -ivh MysqL-server-5.6.12-2.el6.x86_64.rpm
Preparing...                ########################################### [100%]
	file /usr/share/MysqL/czech/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/danish/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/dutch/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/english/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/estonian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/french/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/geRMAN/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/greek/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/hungarian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/italian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/japanese/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/korean/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/norwegian-ny/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/norwegian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/polish/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/portuguese/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/romanian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/russian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/serbian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/slovak/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/spanish/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/swedish/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/ukrainian/errmsg.sys from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/Index.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/armscii8.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/ascii.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/cp1250.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/cp1256.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/cp1257.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/cp850.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/cp852.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/cp866.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/dec8.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/geostd8.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/greek.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/hebrew.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/hp8.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/keybcs2.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/koi8r.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/koi8u.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/latin1.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/laTin2.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/laTin5.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/laTin7.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/macce.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/macroman.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64
	file /usr/share/MysqL/charsets/swe7.xml from install of MysqL-server-5.6.12-2.el6.x86_64 conflicts with file from package MysqL-libs-5.1.73-3.el6_5.x86_64

通过如下命令,删除MysqL-libs包,同时忽略软件包的依赖关系:
[root@wc1 Desktop]# rpm -e MysqL-libs --nodeps

再次尝试安装:
[root@wc1 Desktop]# rpm -ivh MysqL-server-5.6.12-2.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:MysqL-server           ########################################### [100%]
2016-08-16 11:46:37 0 [Warning] timestAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-16 11:46:37 4680 [Note] InnoDB: The InnoDB memory heap is disabled
2016-08-16 11:46:37 4680 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builTins
2016-08-16 11:46:37 4680 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-08-16 11:46:37 4680 [Note] InnoDB: Using Linux native AIO
2016-08-16 11:46:37 4680 [Note] InnoDB: Using cpu crc32 instructions
2016-08-16 11:46:37 4680 [Note] InnoDB: Initializing buffer pool,size = 128.0M
2016-08-16 11:46:37 4680 [Note] InnoDB: Completed initialization of buffer pool
2016-08-16 11:46:37 4680 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-08-16 11:46:37 4680 [Note] InnoDB: SetTing file ./ibdata1 size to 12 MB
2016-08-16 11:46:37 4680 [Note] InnoDB: Database physically writes the file full: wait...
2016-08-16 11:46:38 4680 [Note] InnoDB: SetTing log file ./ib_logfile101 size to 48 MB
2016-08-16 11:46:39 4680 [Note] InnoDB: SetTing log file ./ib_logfile1 size to 48 MB
2016-08-16 11:46:40 4680 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-08-16 11:46:40 4680 [Warning] InnoDB: New log files created,LSN=45781
2016-08-16 11:46:40 4680 [Note] InnoDB: Doublewrite buffer not found: creaTing new
2016-08-16 11:46:40 4680 [Note] InnoDB: Doublewrite buffer created
2016-08-16 11:46:40 4680 [Note] InnoDB: 128 rollBACk segment(s) are active.
2016-08-16 11:46:40 4680 [Warning] InnoDB: CreaTing foreign key consTraint system tables.
2016-08-16 11:46:40 4680 [Note] InnoDB: Foreign key consTraint system tables created
2016-08-16 11:46:40 4680 [Note] InnoDB: CreaTing tablespace and DATAFILE system tables.
2016-08-16 11:46:40 4680 [Note] InnoDB: Tablespace and DATAFILE system tables created.
2016-08-16 11:46:40 4680 [Note] InnoDB: WaiTing for purge to start
2016-08-16 11:46:40 4680 [Note] InnoDB: 5.6.12 started; log sequence number 0
A random root password has been set. you will find it in '/root/.MysqL_secret'.
2016-08-16 11:46:42 4680 [Note] binlog end
2016-08-16 11:46:42 4680 [Note] InnoDB: FTS optimize thread exiTing.
2016-08-16 11:46:42 4680 [Note] InnoDB: StarTing shutdown...
2016-08-16 11:46:44 4680 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2016-08-16 11:46:44 0 [Warning] timestAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-16 11:46:44 4705 [Note] InnoDB: The InnoDB memory heap is disabled
2016-08-16 11:46:44 4705 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builTins
2016-08-16 11:46:44 4705 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-08-16 11:46:44 4705 [Note] InnoDB: Using Linux native AIO
2016-08-16 11:46:44 4705 [Note] InnoDB: Using cpu crc32 instructions
2016-08-16 11:46:44 4705 [Note] InnoDB: Initializing buffer pool,size = 128.0M
2016-08-16 11:46:44 4705 [Note] InnoDB: Completed initialization of buffer pool
2016-08-16 11:46:44 4705 [Note] InnoDB: Highest supported file format is Barracuda.
2016-08-16 11:46:44 4705 [Note] InnoDB: 128 rollBACk segment(s) are active.
2016-08-16 11:46:44 4705 [Note] InnoDB: WaiTing for purge to start
2016-08-16 11:46:44 4705 [Note] InnoDB: 5.6.12 started; log sequence number 1625977
2016-08-16 11:46:45 4705 [Note] binlog end
2016-08-16 11:46:45 4705 [Note] InnoDB: FTS optimize thread exiTing.
2016-08-16 11:46:45 4705 [Note] InnoDB: StarTing shutdown...
2016-08-16 11:46:46 4705 [Note] InnoDB: Shutdown completed; log sequence number 1625987




A RANDOM passworD HAS BEEN SET FOR THE MysqL root USER !
you will find that password in '/root/.MysqL_secret'.

You must change that password on your first connect,no other statement but 'SET passworD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also,the account for the anonymous user has been removed.

In addition,you can run:

  /usr/bin/MysqL_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/MysqLbug script!

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

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server setTings

[root@wc1 Desktop]# 

从上面的安装日志中,能够看到很多有用的信息,比如:

A RANDOM passworD HAS BEEN SET FOR THE MysqL root USER !
you will find that password in '/root/.MysqL_secret'.

至此,安装成功


4、下载并安装MysqL 客户端

安装好了MysqL之后,我们需要连接到MysqL,但是由于MysqL-server并不包含客户端,所以还要下载客户端。

先下载:

[root@wc1 Desktop]# wget http://dev.MysqL.com/get/Downloads/mysql-5.6/MysqL-client-5.6.12-2.el6.x86_64.rpm
--2016-08-16 13:20:48--  http://dev.MysqL.com/get/Downloads/mysql-5.6/MysqL-client-5.6.12-2.el6.x86_64.rpm
Resolving dev.MysqL.com... 137.254.60.11
ConnecTing to dev.MysqL.com|137.254.60.11|:80... connected.
http request sent,awaiTing response... 302 Found
LOCATIOn: http://cdn.MysqL.com//archives/mysql-5.6/MysqL-client-5.6.12-2.el6.x86_64.rpm [following]
--2016-08-16 13:20:50--  http://cdn.MysqL.com//archives/mysql-5.6/MysqL-client-5.6.12-2.el6.x86_64.rpm
Resolving cdn.MysqL.com... 23.42.233.185
ConnecTing to cdn.MysqL.com|23.42.233.185|:80... connected.
http request sent,awaiTing response... 200 OK
Length: 18527048 (18M) [application/x-redhat-package-manager]
Saving to: “MysqL-client-5.6.12-2.el6.x86_64.rpm”

100%[======================================>] 18,527,048   959K/s   in 31s     

2016-08-16 13:21:24 (582 KB/s) - “MysqL-client-5.6.12-2.el6.x86_64.rpm” saved [18527048/18527048]

然后安装:
[root@wc1 Desktop]# rpm -ivh MysqL-client-5.6.12-2.el6.x86_64.rpmPreparing...                ########################################### [100%]
   1:MysqL-client           ########################################### [100%]


5、启动MysqL

[root@wc1 Desktop]# service MysqL start
StarTing MysqL....                                         [  OK  ]


检查是否开机自启动:
[root@wc1 Desktop]# chkconfig --list | grep MysqL
MysqL          	0:off	1:off	2:on	3:on	4:on	5:on	6:off


这里的0~6,分别表示不同的runlevel,比如:2是多用户模式除了没有NFS,而3是标准的多用户模式。


如果没有设置,可以通过如下命令来设置:

[root@wc1 Desktop]# chkconfig MysqL on

6、登录MysqL

登录MysqL,就得有密码,而密码就在这文件里'/root/.MysqL_secret'.

于是找到这个文件,这里ls的参数a只指显示所有隐藏的文件,包含以点开头的,而l参数表示显示详细列表:

[root@wc1 ~]# ls -al | grep 'secret'
-rw-------.  1 root root    96 Aug 16 11:46 .MysqL_secret
[root@wc1 ~]# cat .MysqL_secret
# The random password set for the root user at Tue Aug 16 11:46:41 2016 (local timE): 6g2niot5

登录MysqL
[root@wc1 ~]# MysqL -uroot -p
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 5
Server version: 5.6.12 MysqL Community Server (GPL)

Copyright (C) 2000,2013,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered Trademark of Oracle Corporation and/or its
affiliates. Other names may be Trademarks of their respective
owners.

Type 'Help;' or '\h' for Help. Type '\c' to clear the current input statement.

MysqL> set password for root@"wc1.localdomain" = password("yupeigu");
Query OK,1 rows affected (0.03 seC)

用户授权,并刷新权限:

MysqL> grant all privileges on *.* to root@'%' identified by 'yupeigu' with grant option;
Query OK,0 rows affected (0.03 seC)

MysqL> flush privileges;
Query OK,0 rows affected (0.02 seC)

大佬总结

以上是大佬教程为你收集整理的CentOS 6.6上安装MySQL 5.6全部内容,希望文章能够帮你解决CentOS 6.6上安装MySQL 5.6所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。