ITPub博客

首页 > 数据库 > MySQL > 二进制方式安装mysql 5.6.15

二进制方式安装mysql 5.6.15

原创 MySQL 作者:denglt 时间:2014-01-27 15:49:37 0 删除 编辑

1 环境介绍
操作系统:Red Hat Enterprise Linux Server release 5.6  (64位)
 

2 安装软件
二进制包:mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz
Mysql 下载地址:http://dev.mysql.com/downloads/


3 安装步骤

3.1 创建用户
[root@laodeng5 /]# groupadd mysql
[root@laodeng5 /]# useradd -m -r -g mysql mysql
3.2 创建目录
[root@laodeng5 /]# mkdir /opt
3.3 解压
[root@laodeng5 /]# cd /opt
[root@laodeng5 opt]# tar -xzvf /software/mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz
[root@laodeng5 opt]# rename mysql-5.6.15-linux-glibc2.5-x86_64 to mysql
[root@laodeng5 opt]# cd mysql
[root@laodeng5 mysql]# chown -R mysql .
[root@laodeng5 mysql]# chgrp -R mysql .

3.4 安装数据库
[root@laodeng5 mysql]# scripts/mysql_install_db --user=mysql --user=mysql --basedir=/opt/mysql/ --datadir=/opt/mysql/data/
Installing MySQL system tables...2014-01-27 11:00:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-27 11:00:24 26220 [Note] InnoDB: The InnoDB memory heap is disabled
2014-01-27 11:00:24 26220 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-01-27 11:00:24 26220 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-01-27 11:00:24 26220 [Note] InnoDB: Using Linux native AIO
2014-01-27 11:00:24 26220 [Note] InnoDB: Using CPU crc32 instructions
2014-01-27 11:00:24 26220 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-01-27 11:00:24 26220 [Note] InnoDB: Completed initialization of buffer pool
2014-01-27 11:00:24 26220 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-01-27 11:00:24 26220 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-01-27 11:00:24 26220 [Note] InnoDB: Database physically writes the file full: wait...
2014-01-27 11:00:24 26220 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-01-27 11:00:25 26220 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-01-27 11:00:25 26220 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-01-27 11:00:25 26220 [Warning] InnoDB: New log files created, LSN=45781
2014-01-27 11:00:25 26220 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-01-27 11:00:25 26220 [Note] InnoDB: Doublewrite buffer created
2014-01-27 11:00:25 26220 [Note] InnoDB: 128 rollback segment(s) are active.
2014-01-27 11:00:26 26220 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-01-27 11:00:26 26220 [Note] InnoDB: Foreign key constraint system tables created
2014-01-27 11:00:26 26220 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-01-27 11:00:26 26220 [Note] InnoDB: Tablespace and datafile system tables created.
2014-01-27 11:00:26 26220 [Note] InnoDB: Waiting for purge to start
2014-01-27 11:00:26 26220 [Note] InnoDB: 5.6.15 started; log sequence number 0
2014-01-27 11:00:26 26220 [Note] Binlog end
2014-01-27 11:00:26 26220 [Note] InnoDB: FTS optimize thread exiting.
2014-01-27 11:00:26 26220 [Note] InnoDB: Starting shutdown...
2014-01-27 11:00:28 26220 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

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

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /opt/mysql//bin/mysqladmin -u root password 'new-password'
  /opt/mysql//bin/mysqladmin -u root -h laodeng5.localdomain password 'new-password'

Alternatively you can run:

  /opt/mysql//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.

You can start the MySQL daemon with:

  cd . ; /opt/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./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 /opt/mysql//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@laodeng5 mysql]# chown -R root .
[root@laodeng5 mysql]# chown -R mysql data


3.5 配置数据库
[root@laodeng5 mysql]# mkdir etc
[root@laodeng5 mysql]# mkdir log
[root@laodeng5 mysql]# chown mysql log
[root@laodeng5 mysql]# cp support-files/mysql.server /etc/init.d/

修改密码:
[root@laodeng5 mysql]# bin/mysqladmin -u root password 'mysql'

为了能够service mysql.server start的方式启动mysql,进行如下配置:
方法一:
[root@laodeng5 mysql]# ln –s /opt/mysql /usr/local/mysql
[root@laodeng5 mysql]# cp support-files/my-default.cnf  etc/my.cnf

方法二:
[root@laodeng5 mysql]# cd /ect/init.d
[root@laodeng5 init.d]# vi mysql.server
修改:
basedir=
datadir=

basedir=/opt/mysql
datadir=/opt/mysql/data
[root@laodeng5 init.d]# cd /opt/mysql
[root@laodeng5 mysql]# cp support-files/my-default.cnf  /etc/my.cnf

注意:两种方法的my.cnf位置不同。
可以使用如下命令查看mysql搜索my.cnf配置文件的顺序:
[root@laodeng5 mysql]# bin/mysqld --help --verbose --skip-networking --pid-file=$(tempfile) 2> /dev/null | grep -A1 'Default options are read'
-bash: tempfile: command not found
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/195110/viewspace-1075931/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-11-04

  • 博文量
    118
  • 访问量
    703659