Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2270446
  • 博文数量: 168
  • 博客积分: 6641
  • 博客等级: 准将
  • 技术积分: 1996
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-02 11:49
文章存档

2020年(4)

2019年(6)

2017年(1)

2016年(3)

2015年(3)

2014年(8)

2013年(2)

2012年(12)

2011年(19)

2010年(10)

2009年(3)

2008年(17)

2007年(80)

分类: LINUX

2013-12-23 12:21:04

MySQL 5.6.15 bundle包安装
 
2013.12.23 TsengYia@126.com http://tsengyia.blog.chinaunix.net
 
#########################################################################
 
系统环境:
    RHEL6.4[2.6.32-358.el6.x86_64]
 
软件环境:
    [—— MySQL官方下载]
    MySQL-shared-5.6.15-1.el6.x86_64.rpm    //共享库
    MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm   //兼容包
    MySQL-devel-5.6.15-1.el6.x86_64.rpm    //库和头文件
    MySQL-embedded-5.6.15-1.el6.x86_64.rpm    //嵌入式版本
    MySQL-test-5.6.15-1.el6.x86_64.rpm    //测试包
    MySQL-server-5.6.15-1.el6.x86_64.rpm    //服务端程序
    MySQL-client-5.6.15-1.el6.x86_64.rpm    //客户端程序

#########################################################################
 
一、下载及解包

1. 下载MySQL 5.6.15

下载页面:http://dev.mysql.com/downloads/mysql/
选择“Red Hat Enterprise Linux 6/Oracle Linux 6 (x86, 64-bit), RPM Bundle”,
下载的文件名为 MySQL-5.6.15-1.el6.x86_64.rpm-bundle 。
 
2. 解压tar包

[root@dbsvr1 ~]# cd /var/ftp/pub/
[root@dbsvr1 pub]# tar xf MySQL-5.6.15-1.el6.x86_64.rpm-bundle.tar
[root@dbsvr1 pub]# ls
    MySQL-shared-5.6.15-1.el6.x86_64.rpm
    MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm
    MySQL-server-5.6.15-1.el6.x86_64.rpm
    MySQL-client-5.6.15-1.el6.x86_64.rpm
    MySQL-devel-5.6.15-1.el6.x86_64.rpm    //开发库,也可不装
    MySQL-embedded-5.6.15-1.el6.x86_64.rpm    //嵌入式版本,可不装
    MySQL-test-5.6.15-1.el6.x86_64.rpm    //测试包,可不装


二、以RPM方式安装MySQL各软件包

1. 准备工作
确保已卸载掉RHEL自带的mysql-server、mysql包。
RHEL自带的mysql-libs暂时保留(如果直接卸载会因为依赖关系删除许多重要的包,比如crontab、postfix等),安装新包的时候通过“-U”升级相关文件。

[root@dbsvr1 pub]# yum -y remove mysql-server mysql
.. ..
[root@dbsvr1 pub]# mv /etc/my.cnf /etc/my.cnf.old //清理残留配置文件


2. 依次安装共享库、兼容包、客户端、服务端、开发库
[root@dbsvr1 pub]# rpm -Uvh MySQL-shared-*.rpm MySQL-client-*.rpm MySQL-server-*.rpm MySQL-devel-*.rpm
.. ..

其中首次MySQL-server包时,会出现一些警告和提示信息:
[root@dbsvr1 pub]# rpm -Uvh MySQL-server-5.6.15-1.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
2013-12-23 11:21:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
      // 注:在5.6.6之前的版本中,TIMESTAMP列如果没有明确声明NULL属性,默认为NOT NULL;从5.6.6开始不再推荐这种方式
      // 后面可在/etc/my.cnf配置文件中添加提示的配置以关闭此警告
2013-12-23 11:21:45 2522 [Note] InnoDB: The InnoDB memory heap is disabled
2013-12-23 11:21:45 2522 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-12-23 11:21:45 2522 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-12-23 11:21:45 2522 [Note] InnoDB: Using Linux native AIO
2013-12-23 11:21:45 2522 [Note] InnoDB: Using CPU crc32 instructions
2013-12-23 11:21:45 2522 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-12-23 11:21:45 2522 [Note] InnoDB: Completed initialization of buffer pool
2013-12-23 11:21:45 2522 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-12-23 11:21:45 2522 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-12-23 11:21:45 2522 [Note] InnoDB: Database physically writes the file full: wait...
2013-12-23 11:21:46 2522 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-12-23 11:21:48 2522 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-12-23 11:21:50 2522 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-12-23 11:21:50 2522 [Warning] InnoDB: New log files created, LSN=45781
2013-12-23 11:21:50 2522 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-12-23 11:21:50 2522 [Note] InnoDB: Doublewrite buffer created
2013-12-23 11:21:50 2522 [Note] InnoDB: 128 rollback segment(s) are active.
2013-12-23 11:21:50 2522 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-12-23 11:21:50 2522 [Note] InnoDB: Foreign key constraint system tables created
2013-12-23 11:21:50 2522 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-12-23 11:21:50 2522 [Note] InnoDB: Tablespace and datafile system tables created.
2013-12-23 11:21:50 2522 [Note] InnoDB: Waiting for purge to start
2013-12-23 11:21:50 2522 [Note] InnoDB: 5.6.15 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2013-12-23 11:21:51 2522 [Note] Binlog end
2013-12-23 11:21:51 2522 [Note] InnoDB: FTS optimize thread exiting.
2013-12-23 11:21:51 2522 [Note] InnoDB: Starting shutdown...
2013-12-23 11:21:53 2522 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2013-12-23 11:21:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2013-12-23 11:21:53 2547 [Note] InnoDB: The InnoDB memory heap is disabled
2013-12-23 11:21:53 2547 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-12-23 11:21:53 2547 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-12-23 11:21:53 2547 [Note] InnoDB: Using Linux native AIO
2013-12-23 11:21:53 2547 [Note] InnoDB: Using CPU crc32 instructions
2013-12-23 11:21:53 2547 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-12-23 11:21:53 2547 [Note] InnoDB: Completed initialization of buffer pool
2013-12-23 11:21:53 2547 [Note] InnoDB: Highest supported file format is Barracuda.
2013-12-23 11:21:53 2547 [Note] InnoDB: 128 rollback segment(s) are active.
2013-12-23 11:21:53 2547 [Note] InnoDB: Waiting for purge to start
2013-12-23 11:21:53 2547 [Note] InnoDB: 5.6.15 started; log sequence number 1625977
2013-12-23 11:21:53 2547 [Note] Binlog end
2013-12-23 11:21:53 2547 [Note] InnoDB: FTS optimize thread exiting.
2013-12-23 11:21:53 2547 [Note] InnoDB: Starting shutdown...
2013-12-23 11:21:55 2547 [Note] InnoDB: Shutdown completed; log sequence number 1625987


A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !    //提示已为数据库用户root生成随机密码
You will find that password in '/root/.mysql_secret'.     //记录在/root/.mysql_secret文件内

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.    //必须使用SET PASSWORD语句来为root重新设置密码
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

 

Support MySQL by buying support/licenses at

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@dbsvr1 pub]#

 

三、简单配置及调整

1. 建立/etc/my.cnf配置文件
    手动拷贝建立,并添加关闭TIMPSTAMP警告的设置:

[root@dbsvr1 pub]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf   //若需使用my.cnf文件,需手动拷贝
[root@dbsvr1 pub]# vim /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
explicit_defaults_for_timestamp=true

2. 修改管理密码

1)获得安装时生成的随机密码

[root@dbsvr1 pub]# cat /root/.mysql_secret
# The random password set for the root user at Mon Dec 23 11:21:51 2013 (local time): 8FXWp7lo

2)启动mysql服务程序(注意!!服务名是mysql,不是mysqld)

[root@dbsvr1 pub]# service mysql start
Starting MySQL..                                           [确定]
[root@dbsvr1 pub]# service mysql status
MySQL running (2789)                                       [确定]

3)为root用户重设密码

[root@dbsvr1 pub]# mysql -u root -p
Enter password:        //输入前面的随机密码验证
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.15

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'@'localhost'=PASSWORD('pwd123');   //重设密码为pwd123
Query OK, 0 rows affected (0.15 sec)

mysql> quit
Bye

4)重启mysql服务程序

[root@dbsvr1 pub]# service mysql restart
Shutting down MySQL..                                      [确定]
Starting MySQL..                                           [确定]

#########################################################################

阅读(8307) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~