Deployment of MySQL5.6 and centos6mysql5.6 in Centos6 source code
Mysql starts from Version 5.5 and does not use./configure for compilation. Instead, it uses the cmake compiler. For specific cmake compilation parameters, refer to the mysql official website documentation (※very important)
Http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
Source code package mysql-5.6.16.tar.gz:
Http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz
My mysql directory configuration is as follows:
Installation path:/usr/local/mysql
Database path:/data/mysql
Source code package storage location:/usr/software
Preparation: Install the basic dependency package. First install cmake, automake, and autoconf with yum. Also, the minimum packages required for MySQL 5.6.x include bison, gcc, gcc-c ++, and ncurses-devel.
[Root @ localhost ~] # Yum install cmake make-y
[Root @ localhost ~] # Yum install gcc-c ++ autoconf bison automake zlib * fiex * libxml * ncurses-devel libmcrypt * libtool-ltdl-devel *-y
[Root @ localhost ~] # Cp/root/mysql-5.6.15.tar.gz/usr/software/
[Root @ localhost ~] # Cd/usr/software
Start compilation and Installation
[Root @ localhost ~] # Tar-zxvf mysql-5.6.15.tar.gz
[Root @ localhost ~] # Cd mysql-5.6.15
[Root @ localhost ~] # Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_UNIX_ADDR =/data/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_DATADIR =/data/mysql /\
-DMYSQL_USER = mysql \
-DMYSQL_TCP_PORT = 3306
[Root @ localhost ~] # Make & make install
Brief translation of mysql official website English documents
The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly. (Note: by default, mysql supports the following database engines: MyISAM, MERGE, MEMORY, and CSV. You do not need to declare them during compilation)
Therefore, the preceding compilation condition saves the following two rows:
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
However, INNODB must be installed in declarative mode.
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
Check whether mysql. mysql users and groups exist.
[Root @ localhost ~] # Cat/etc/passwd | grep mysql
Mysql: x: 501: 503:/home/mysql:/bin/bash
[Root @ localhost ~] # Cat/etc/group | grep mysql
Mysql: x: 503:
If it is not OK, execute the following two lines (otherwise, skip this step)
[Root @ localhost ~] # Groupadd mysql# Add a mysql user group
[Root @ localhost ~] # Useradd mysql-g mysql-s/sbin/nologin# Add a mysql user
The following command with a red font is very, and must be executed
[Root @ localhost ~] # Cd/usr/local/mysql
[Root @ localhost ~] # Chown mysql. mysql-R.# Grant the mysql directory execution permissions to mysql users
[Root @ localhost ~] #Chown mysql. mysql-R/data/mysql
[Root @ localhost ~] #Cp support-files/my-default.cnf/Etc/my. cnf# Mysql configuration file
[Root @ localhost ~] # Chmod 755 scripts/mysql_install_db# Grant the execution permission of mysql_install_db
Run the following command to configure mysql startup and Automatic startup:
[Root @ localhost ~] #Scripts/mysql_install_db-- User = mysql-- Basedir =/usr/local/mysql -- datadir =/data/mysql/
Output the following information:
13:58:23 25913 [Note] InnoDB: The InnoDB memory heap is disabled
13:58:23 25913 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
13:58:23 25913 [Note] InnoDB: Compressed tables use zlib 1.2.3
13:58:23 25913 [Note] InnoDB: Using Linux native AIO
13:58:23 25913 [Note] InnoDB: Not using CPU crc32 instructions
13:58:23 25913 [Note] InnoDB: Initializing buffer pool, size = 128.0 M
13:58:23 25913 [Note] InnoDB: Completed initialization of buffer pool
13:58:23 25913 [Note] InnoDB: The first specified data file./ibdata1 did not exist: a new database to be created!
13:58:23 25913 [Note] InnoDB: Setting file./ibdata1 size to 12 MB
13:58:23 25913 [Note] InnoDB: Database physically writes the file full: wait...
13:58:23 25913 [Note] InnoDB: Setting log file./ib_logfile101 size to 48 MB
13:58:24 25913 [Note] InnoDB: Setting log file./ib_logfile1 size to 48 MB
13:58:24 25913 [Note] InnoDB: Renaming log file./ib_logfile101 to./ib_logfile0
13:58:24 25913 [Warning] InnoDB: New log files created, LSN = 45781
13:58:24 25913 [Note] InnoDB: Doublewrite buffer not found: creating new
13:58:24 25913 [Note] InnoDB: Doublewrite buffer created
13:58:24 25913 [Note] InnoDB: 128 rollback segment (s) are active.
13:58:24 25913 [Warning] InnoDB: Creating foreign key constraint system tables.
13:58:24 25913 [Note] InnoDB: Foreign key constraint system tables created
13:58:24 25913 [Note] InnoDB: Creating tablespace and datafile system tables.
13:58:24 25913 [Note] InnoDB: Tablespace and datafile system tables created.
13:58:24 25913 [Note] InnoDB: Waiting for purge to start
13:58:24 25913 [Note] InnoDB: 5.6.15 started; log sequence number 0
13:58:26 25913 [Note] Binlog end
13:58:26 25913 [Note] InnoDB: FTS optimize thread exiting.
13:58:26 25913 [Note] InnoDB: Starting shutdown...
13:58:27 25913 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables... 2013-12-12 13:58:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details ).
13:58:27 25936 [Note] InnoDB: The InnoDB memory heap is disabled
13:58:27 25936 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
13:58:27 25936 [Note] InnoDB: Compressed tables use zlib 1.2.3
13:58:27 25936 [Note] InnoDB: Using Linux native AIO
13:58:27 25936 [Note] InnoDB: Not using CPU crc32 instructions
13:58:27 25936 [Note] InnoDB: Initializing buffer pool, size = 128.0 M
13:58:27 25936 [Note] InnoDB: Completed initialization of buffer pool
13:58:27 25936 [Note] InnoDB: Highest supported file format is Barracuda.
13:58:27 25936 [Note] InnoDB: 128 rollback segment (s) are active.
13:58:27 25936 [Note] InnoDB: Waiting for purge to start
13:58:27 25936 [Note] InnoDB: 5.6.15 started; log sequence number 1625977
13:58:27 25936 [Note] Binlog end
13:58:27 25936 [Note] InnoDB: FTS optimize thread exiting.
13:58:27 25936 [Note] InnoDB: Starting shutdown...
13:58:29 25936 [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:
/Usr/local/mysql/bin/mysqladmin-u root password 'new-password'
/Usr/local/mysql/bin/mysqladmin-u root-h ziteng26 password 'new-password'
Alternatively you can run:
/Usr/local/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
Stronugly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon:
Cd.;/usr/local/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
Http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as/usr/local/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
WARNING: Default config file/etc/my. cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use
-- Defaults-file argument to mysqld_safe when starting the server
[Root @ localhost ~] #Cp support-files/mysql. server/etc/init. d/mysqld
[Root @ localhost ~] # Chmod 755/etc/init. d/mysqld
Check whether the mysqld service is set to start upon startup
[Root @ localhost ~] # Chkconfig -- list | grep mysqld
Set to boot
[Root @ localhost ~] # Chkconfig mysqld on
Starting the mysql database will output a series of useful information, telling you how to initialize mysql
[Root @ CentOSMysql] # service mysqld start
Follow these steps to initialize the administrator root password.
[Root @ localhost ~] #/Usr/local/mysql/bin/mysqladmin-u root password 'yourpassword'
Here, set yourpassword to manager.
As we all know, mysql has two account types: localhost and %. The former only allows the local machine to connect to mysql, and the latter can be used for other machines to remotely connect to mysql.
Finally, handle account logon issues so that the root account password can be used locally and remotely.
[Root @ localhost ~] #/Usr/local/mysql/bin/mysql-u root-p# After you press this command, the screen will prompt you to enter the password and enter yourpassword set in the previous step.
Delete records with empty root passwords
Mysql> use mysql;
Mysql> delete from user where password = '';
Mysql> flush privileges;
Configure mysql to allow remote root login# Logon
Mysql> grant all privileges on *. * to root @ '%' identified by "manager ";
Mysql> flush privileges;
Mysql> select User, Password, Host from user;
If the preceding command is successfully executed
Mysql> quit
So far, mysql installation has been completed.
From http://blog.sina.com.cn/s/blog_53decf440101qiv0.html