1. Operating system
CentOS Release 6.2 (Final)
2. Create users and Groups
[[email protected] ~]# Groupadd MySQL
[Email protected] ~]# useradd-r-G mysqlmysql
3. Unzip the installation package (unzip to where you want to store the database data)
[Email protected] ~]# Cd/data
[Email protected] data]# tar-xzvf/root/mysql_soft/mysql-5.6.19-linux-glibc2.5-x86_64.tar.gz
[[email protected] data]# ln-s mysql-5.6.19-linux-glibc2.5-x86_64 MySQL
4. View the decompression situation
[email protected] data]# LL
Total dosage 20
lrwxrwxrwx. 1 root root 6 months 15:31 MySQL --mysql-5.6.19-linux-glibc2.5-x86_64
drwxr-xr-x. rootroot 4096 6 Month 15:31 mysql-5.6.19-linux-glibc2.5-x86_64
5. Modify the folder to belong to the user and group for MySQL:
[[Email protected] data]# CD MySQL
[Email protected] mysql]# chown-r mysql:mysql.
6. Install the database, the data storage directory is/data/mysql/data
[[email protected] MySQL] #scripts/mysql_install_db--user=mysql--basedir=/data/mysql--datadir=/data/mysql/data
Warning:the host ' Mymaster1.localdomain ' could not being looked up with/data/mysql/bin/resolveip.
This probably means Thatyour libc libraries is not compatible
With this binary mysqlversion. The MySQL daemon, mysqld, should work
Normally with the Exceptionthat host name resolving won't work.
This means, youshould use IP addresses instead of hostnames
When specifying Mysqlprivileges!
When the warning above occurs, the workaround is to increase the IP address and host name mappings in the/etc/hosts configuration file
Such as
[Email protected] packages]# cat/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
IP Address Mymaster1.localdomain
The correct prompt information is as follows:
[[email protected] MySQL] #scripts/mysql_install_db--user=mysql--basedir=/data/mysql--datadir=/data/mysql/data
Installing MySQL system tables ... 2014-06-2716:02:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. --explicit_defaults_for_timestamp server Option (see documentationfor more details).
2014-06-27 16:02:45 2134 [Note] innodb:using Atomics to ref count buffer pool pages
2014-06-27 16:02:45 2134 [Note] innodb:theinnodb memory heap is disabled
2014-06-27 16:02:45 2134 [Note] innodb:mutexes and rw_locks use GCC atomic builtins
2014-06-27 16:02:45 2134 [Note] innodb:compressed tables use zlib 1.2.3
2014-06-27 16:02:45 2134 [Note] innodb:using Linux native AIO
2014-06-27 16:02:45 2134 [Note] innodb:using CPU CRC32 Instructions
2014-06-27 16:02:45 2134 [Note] innodb:initializing buffer pool, size = 128.0M
2014-06-27 16:02:45 2134 [Note] innodb:completed initialization of buffer pool
2014-06-27 16:02:45 2134 [Note] innodb:thefirst specified data file./ibdata1 did not exist:a new database to becreated!
2014-06-27 16:02:45 2134 [Note] innodb:setting file./ibdata1 size to MB
2014-06-27 16:02:45 2134 [Note] Innodb:database physically writes the file full:wait ...
2014-06-27 16:02:45 2134 [Note] innodb:setting log file./ib_logfile101 size to + MB
2014-06-27 16:02:46 2134 [Note] innodb:setting log file./ib_logfile1 size to + MB
2014-06-27 16:02:46 2134 [Note] innodb:renaming log file./ib_logfile101 to./ib_logfile0
2014-06-27 16:02:46 2134 [Warning] innodb:new log files created, lsn=45781
2014-06-27 16:02:46 2134 [Note] innodb:doublewrite buffer not found:creating new
2014-06-27 16:02:46 2134 [Note] Innodb:doublewrite buffer created
2014-06-27 16:02:46 2134 [Note] innodb:128rollback segment (s) is active.
2014-06-27 16:02:46 2134 [Warning] innodb:creating FOREIGN KEY constraint system tables.
2014-06-27 16:02:46 2134 [Note] innodb:foreign key constraint system tables created
2014-06-27 16:02:46 2134 [Note] innodb:creating tablespace and datafile system tables.
2014-06-27 16:02:46 2134 [Note] innodb:tablespace and datafile system tables created.
2014-06-27 16:02:46 2134 [Note] innodb:waiting for purge to start
2014-06-27 16:02:46 2134 [Note] innodb:5.6.19 started; Log sequence number 0
2014-06-27 16:02:47 2134 [Note] Binlog End
2014-06-27 16:02:47 2134 [Note] innodb:ftsoptimize thread exiting.
2014-06-27 16:02:47 2134 [Note] innodb:starting shutdown ...
2014-06-27 16:02:48 2134 [Note] Innodb:shutdown completed; Log sequence Number 1625977
Ok
Filling Help Tables ... 2014-06-27 16:02:48 0[warning] TIMESTAMP with implicit the DEFAULT value is deprecated. Use--explicit_defaults_for_timestamp server option (see documentation for Moredetails).
2014-06-27 16:02:48 2157 [Note] innodb:using Atomics to ref count buffer pool pages
2014-06-27 16:02:48 2157 [Note] innodb:theinnodb memory heap is disabled
2014-06-27 16:02:48 2157 [Note] innodb:mutexes and rw_locks use GCC atomic builtins
2014-06-27 16:02:48 2157 [Note] innodb:compressed tables use zlib 1.2.3
2014-06-27 16:02:48 2157 [Note] innodb:using Linux native AIO
2014-06-27 16:02:48 2157 [Note] innodb:using CPU CRC32 Instructions
2014-06-27 16:02:48 2157 [Note] innodb:initializing buffer pool, size = 128.0M
2014-06-27 16:02:48 2157 [Note] innodb:completed initialization of buffer pool
2014-06-27 16:02:48 2157 [Note] innodb:highest supported file format is Barracuda.
2014-06-27 16:02:48 2157 [Note] innodb:128rollback segment (s) is active.
2014-06-27 16:02:48 2157 [Note] innodb:waiting for purge to start
2014-06-27 16:02:48 2157 [Note] innodb:5.6.19 started; Log sequence Number 1625977
2014-06-27 16:02:48 2157 [Note] Binlog End
2014-06-27 16:02:48 2157 [Note] innodb:ftsoptimize thread exiting.
2014-06-27 16:02:48 2157 [Note] innodb:startingshutdown ...
2014-06-27 16:02:50 2157 [Note] Innodb:shutdown completed; Log sequence Number 1625987
Ok
To start mysqld at boot time with tocopy
Support-files/mysql.server to the rightplace for your system
REMEMBER to SET A PASSWORD for themysql root USER!
To do, start the server, then issue thefollowing commands:
/data/mysql/bin/mysqladmin-u root password ' new-password '
/data/mysql/bin/mysqladmin-u root-h mymaster1.localdomain password ' new-password '
Alternatively you can run:
/data/mysql/bin/mysql_secure_installation
Which would also give you the option ofremoving the test
Databases and anonymous user created Bydefault. This is
Strongly recommended for Productionservers.
See the Manual for more instructions.
You can start the MySQL daemon with:
CD.; /data/mysql/bin/mysqld_safe &
You can test the MySQL daemon withmysql-test-run.pl
Cdmysql-test; Perl mysql-test-run.pl
Problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
Http://www.mysql.com
Support for MySQL by buying Support/licenses athttp://shop.mysql.com
New Default Config file was created as/data/mysql/my.cnf and
Would be used by default by the server whenyou start it.
You could edit this file to the change serversettings
7. Modify the relevant directory permissions to improve security:
[Email protected] mysql]# chown-r root.
[[email protected] mysql]# chown-r mysql data
8. Configure the MySQL service to host the service, that is, you can start services using service MySQL start
[Email protected] mysql]# Cpsupport-files/mysql.server/etc/init.d/mysql
[Email protected] mysql]# Vi/etc/init.d/mysql
Put the following
Basedir=
Datadir=
Revision changed to
Basedir=/data/mysql
Datadir=/data/mysql/data
9. Start the database
[[Email protected] mysql]# service MySQL start
Starting mysql[OK]
10. Modify the database root password
[[email protected] mysql]#/data/mysql/bin/mysqladmin-u root password ' wengjixi '
[Email protected] mysql]#/data/mysql/bin/mysqladmin-u root-h mymaster1.localdomain password ' wengjixi '
11. Modify the environment variable to add the MySQL executable file path to the environment variable
[Email protected] mysql]# Vi/etc/profile
Path= $PATH:/data/mysql/bin
Export PATH
[Email protected] mysql]# Source/etc/profile
12. Test Login
[Email protected] mysql]# mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 5
Server version:5.6.19 MySQL communityserver (GPL)
Copyright (c) and/or, Oracle, Itsaffiliates. All rights reserved.
Oracle is a registered trademark of oraclecorporation and/or its
Affiliates. Other names trademarksof their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' toclear the current input statement.
Mysql>
Mysql> Show variables like '%data% ';
+-------------------------------+------------------------+
| variable_name | Value |
+-------------------------------+------------------------+
| Character_set_database | Latin1 |
| Collation_database | Latin1_swedish_ci |
| DataDir | /data/mysql/data/