How to install multi-instance mysql database
This article mainly tells you how to install multi-instance mysql database. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on how to install multi-instance mysql database can bring you some practical help.
1. Experimental environment
System: cetos6.5
Software: mysql-5.5.32.tar.gz
Second, the experimental steps
1.1 install cmake software
Tar xf cmake-2.8.8.tar.gz
Cd cmake-2.8.8
. / configure
Gmake
Gmake install
1.2 create users and groups and install mysql dependency packages
Groupadd mysql
Useradd mysql-s / sbin/nologin-M msyql
Yum-y install ncurses-devel
1.3 decompress, compile and install mysql
Tar xf mysql-5.5.32.tar.gz
Cd mysql-5.5.32.tar.gz
Cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\
-DMYSQL_DATADIR=/application/mysql-5.5.32/data\
-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii\
-DENABLED_LOCAL_INFILE=ON\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_FEDERATED_STORAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\
-DWITHOUT_PARTITION_STORAGE_ENGINE=1\
-DWITH_FAST_MUTEXES=1\
-DWITH_ZLIB=bundled\
-DENABLED_LOCAL_INFILE=1\
-DWITH_READLINE=1\
-DWITH_EMBEDDED_SERVER=1\
-DWITH_DEBUG=0
Make & & make install
1.4 configuration environment variables are written to the / etc/profile file
PATH= "/ application/mysql/bin:$PATH"
1.5 create a multi-instance directory startup script configuration file and its authorization
/ data/
├── 3306
│ ├── data
│ ├── my.cnf
│ └── mysql
└── 3307
├── data
├── my.cnf
└── mysql
Chown-R mysql.mysql / data/
Find / data/-type f-name "mysql" | xargs chmod + x
/ data/3306/mysql start-start the mysql process
/ data/3307/mysql start-start the mysql process
1.6 Log in to mysql via socket multi-instance
Mysql-S / data/3306/mysql.sock
Mysql-S / data/3307/mysql.sock
1.7 change password
Mysqladmin-uroot-S / data/3306/mysql.sock password '123'
Mysqladmin-uroot-S / data/3307/mysql.sock password '123'
1.8 login method after changing password
Mysql-uroot-p-S / data/3306/mysql.sock
Mysql-uroot-p-S / data/3307/mysql.sock
1.9 achieve a successful login
~] # mysql-uroot-p-S / data/3306/mysql.sock
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.5.32 Source distributio
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql >
~] # mysql-uroot-p-S / data/3307/mysql.sock
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.5.32 Source distributio
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement
Mysql >
How to install multi-instance mysql database will first tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.