二進位制方式安裝mysql 5.6.15

denglt發表於2014-01-27

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章