Reference: http://www.centoscn.com/CentosServer/sql/2013/0817/1285.html
Installation environment: Linux Server CentOS 5.5
Installed version: mysql-5.6.22.tar.gz
1, install the CMake compiler.
1), download CMake
#cd/USR/LOCAL/SRC
#wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
2), decompression CMake
#tar-ZVXF cmake-2.8.4.tar.gz
3), configuration compilation
#cd cmake-2.8.4
#yum-y Install gcc
#yum-y Install gcc-c++
#yum-y Install Ncurses-devel
#./configure
#make
#make Install
2. Install MySQL
1), download MySQL.
#cd/USR/LOCAL/SRC
#wget dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6.22.tar.gz
2), add the necessary groups and owners
#groupadd MySQL
#useradd-R-G MySQL MySQL
3), unzip MySQL
#tar-ZVXF mysql-5.5.9.tar.gz
4), configuration compilation
If you are reloading MySQL, please remove my.cnf first, such as: RM-RF/ETC/MY.CNF
#mkdir/usr/local/mysql
#mkdir/usr/local/mysql/data
#cd/usr/local/src/mysql-5.5.9
#cmake. \
-dcmake_install_prefix=/usr/local/mysql \
-dinstall_datadir (or-dmysql_datadir) =/usr/local/mysql/data \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dextra_charsets=all \
-denabled_local_infile=1
Parameter description:
-dcmake_install_prefix=/usr/local/mysql//installation directory
-dinstall_datadir=/usr/local/mysql/data//Database storage directory
-ddefault_charset=utf8//using UTF8 characters
-DDEFAULT_COLLATION=UTF8_GENERAL_CI//Check character
-dextra_charsets=all//Install all extended character sets
-denabled_local_infile=1//Allow import of data from local
#make
#make Install
Precautions:
When you recompile, you need to clear the old object file and cache information.
# Make Clean
# rm-f CMakeCache.txt
# RM-RF/ETC/MY.CNF
4), set directory permissions
# Cd/usr/local/mysql
# Chown-r Root:mysql. Set the owner owner of all files in the current directory to root, and the owning group is MySQL
# chown-r Mysql:mysql Data
5), configuration file
# CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF//This configuration is only suitable for small memory systems (32M-64M)
Open the following comment :
Innodb_data_home_dir =/usr/local/mysql/data
Innodb_data_file_path = Ibdata1:10m:autoextend
Innodb_log_group_home_dir =/usr/local/mysql/data
Innodb_buffer_pool_size = 16M
Innodb_additional_mem_pool_size = 2M
Innodb_log_file_size = 5M
Innodb_log_buffer_size = 8M
Innodb_flush_log_at_trx_commit = 1
Innodb_lock_wait_timeout = 50
To add a default character set :
[Client]
Default-character-set = UTF8//Add encoding support
[Mysqld]
Default-character-set = UTF8//Add encoding support
Max_connections = 10000//based on server performance tuning
basedir =/usr/local/mysql //Set the installation directory so that it runs correctly to/etc/rc.d/init.d/mysql start when the system starts
6), create a table for the system database
# Cd/usr/local/mysql
# scripts/mysql_install_db--user=mysql
7), set permissions to start
Set Environment variables :
# Vi/root/.bash_profile
In path= $PATH: $HOME/bin add parameters as:
Path= $PATH: $HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
#source/root/.bash_profile
To start MySQL manually:
# Cd/usr/local/mysql
#./bin/mysqld_safe--user=mysql &//start MySQL, but cannot stop
The boot log is written under this file:/usr/local/mysql/data/localhost.err
Turn off MySQL service
# mysqladmin-u Root-p shutdown//Here the root user of MySQL has not configured the password, so it is null.
To start MySQL with a script:
Cp/usr/loacl/mysql/support-files/mysql.server/etc/rc.d/init.d/mysql
# CD/ETC/RC.D/INIT.D
# chkconfig--add MySQL//configuration is automatically started, chkconfig--del MySQL can be deleted
# chmod +x/etc/rc.d/init.d/mysql//Add as Execute permission
8), Modify the password of the root user of MySQL :
# mysql-u Root MySQL
Mysql>use MySQL;
Mysql>desc user;
mysql> GRANT All privileges on * * to [email protected] '% ' identified by ' root '; The ability to add remote connections for root.
Mysql>update user Set Password = Password ('xxxxxx') where user= ' root ';
Mysql>select Host,user,password from User where user= ' root ';
Mysql>flush privileges;
Mysql>exit
Re-login: Mysql-u root-p
9), export database generate SQL script
Mysqldump-h 192.168.200.18-u root-p TestDB > Testdb.sql
<2>, testing the MySQL daemon.
#cd/usr/local/mysql/mysql-test;
#perl mysql-test-run.pl
installing MySQL under CentOS