Error
Http://www.phperz.com/article/14/1208/39937.html
I. Preparation
Test software mysql-5.5.36
System version CentOS release 6.5 (Final) 64bit
----------------------------------------------------------------------------------
| instance | Port |data Location | profile | Boot File |
----------------------------------------------------------------------------------
|mysql3306|3306 |/data/mysql_3306| /ETC/MY3306.CNF |/etc/init.d/mysql.server3306 |
----------------------------------------------------------------------------------
|mysql3307|3307 |/data/mysql_3307| /ETC/MY3307.CNF |/etc/init.d/mysql.server3307 |
----------------------------------------------------------------------------------
Download package
Usually put in/opt/mysql.
wget http://downloads.mysql.com/archives/get/file/mysql-5.5.36.tar.gz
TAR-ZXVF mysql-5.5.36.tar.gz
Yum-y Install CMake
Yum-y install gcc gcc-c++ autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* cmake Cmake-gui Libaio-devel bision
(Connaught appears error:missing dependency:kernel-headers glibc not fit)
http://vault.centos.org/5.8/os/x86_64/CentOS/kernel-headers-2.6.18-308.el5.x86_64.rpm
Download wget http://vault.centos.org/5.7/os/x86_64/CentOS/kernel-headers-2.6.18-274.el5.x86_64.rpm
Installing RPM-IVH kernel-headers-2.6.18-274.el5.x86_64.rpm
Http://blog.sina.com.cn/s/blog_8f27abe50101204l.html
Create user
Groupadd MySQL
Useradd-g mysql-s/sbin/nologin-m MySQL
Create an installation directory to authorize users
Mkdir-p/data/mysql5536
Chown-r mysql:mysql/data/
Two. Installation
Unzip the installation (set the default location for the installation to/data/mysql5536)
cd/opt/mysql/mysql-5.5.36
CMake. -dcmake_install_prefix=/data/mysql5536-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_ General_ci-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_readline=1-denabled_local_ Infile=1
Make && make install
If the compilation fails here, delete the CMakeCache.txt. Re-installation of the late dependence on re-cmake. Otherwise, the error is always indicated.
Three. database file (create instance)
Initializing the database
/data/mysql5536/scripts/mysql_install_db--basedir=/data/mysql5536/--datadir=/data/mysql_3306--user=mysql
Create a MY.CNF file
CP my.cnf MY3306.CNF
Vi/data/mysql_3306/my.cnf
[Client]
Port = 3306 #默认3306
Socket =/data/mysql_3306/mysql.sock
[Mysqld]
Port = 3306
Socket =/data/mysql_3306/mysql.sock
datadir=/data/mysql_3306
User=mysql
wait_timeout=1814400
interactive_timeout=1814400
Lower_case_table_names=1
Expire-logs-days = 1
Skip-name-resolve
[Mysqld_safe]
Log-error=/data/mysql_3306/mysqld.log
Pid-file=/data/mysqld_3306/mysqld.pid
Remember to change the path owner of the instance to MySQL
Chown-r mysql:mysql/data/mysql_3306
Four. Start the database
Start the DB instance
cp/data/mysql5536/support-files/mysql.server/etc/init.d/mysql.server3306
vi/etc/init.d/mysql.server3306
The default conf=/etc/my.cnf
Modify to Conf=/etc/my3306.cnf
Open Database
/etc/init.d/mysql.server3306 Start|stop|restart
#/data/mysql5536/bin/mysqld_safe--defaults-extra-file=/data/mysql_3306/my.cnf--datadir=/data/mysql_3306--user= MySQL &
To close a DB instance
Five. Multi-instance Installation
Use the third step to create another instance if another instance is listening on port 3307
1) Initialize the instance database
/data/mysql5536/scripts/mysql_install_db--basedir=/data/mysql5536/--datadir=/data/mysql_3307--user=mysql
2) Create the my.cnf file for the instance
Vi/etc/my3307.cnf
[Client]
Port = 3307 #默认3306
Socket =/data/mysql_3307/mysql.sock
[Mysqld]
Port = 3307
Socket =/data/mysql_3307/mysql.sock
Port = 3306
Socket =/data/mysql_3307/mysql.sock
datadir=/data/mysql_3306
wait_timeout=1814400
interactive_timeout=1814400
Lower_case_table_names=1
Expire-logs-days = 1
Skip-name-resolve
Remember to change the path owner of the instance to MySQL
Chown-r mysql:mysql/data/mysql_3307
3) Start the instance with the fourth step above
cp/data/mysql5536/support-files/mysql.server/etc/init.d/mysql.server3307
vi/etc/init.d/mysql.server3307
The default conf=/etc/my.cnf
Modify to Conf=/etc/my3307.cnf
Open Database
/etc/init.d/mysql.server3307 Start|stop|restart
Enter the specified database
Mysql-uroot-p-s/data/mysql_3306/mysql.sock
Grant all privileges on * * to ' admin ' @ ' percent ' identified by ' 123456 ';
Grant all privileges on * * to ' admin ' @ ' locatehost ' identified by ' 123456 ';
Reference documents
Http://blog.chinaunix.net/uid-25760152-id-3472603.html
This article is from the "Cloud Notepad" blog, please be sure to keep this source http://youngcloud.blog.51cto.com/2873694/1662450
MySQL multi-instance, my.cnf 4G conf Configuration installation Configuration