Home  >  Article  >  Database  >  Running multiple mysql on the same machine

Running multiple mysql on the same machine

黄舟
黄舟Original
2016-12-14 15:26:301051browse

The same machine runs multiple mysql:
The simplest method is to install each mysql under a different user, such as mysql1 and mysql2. Under each user, perform the following operations:
export MYSQL_HOME=/home/mysql1/ mysql
shell> groupadd mysql
shell> useradd -g mysql mysql1
shell> cd /home/mysql1
shell>tar -xzvf /home/mysql1/mysql-VERSION-OS.tar.gz
shell> ln -s mysql- VERSION-OS.tar.gz mysql
shell> cd mysql
cp support-files/my-large.cnf (select according to actual situation) ./my.cnf
vi my.cnf, mainly modify [client] and [mysqld] The following port and socket, and specify the character set, for example:
[client]
port = 3307
socket = /home/mysql1/mysql/data/mysql.sock
# The MySQL server
[mysqld]
default-character- set = utf8
port = 3307
socket = /home/mysql1/mysql/data/mysql.sock
. . . . . .
shell> scripts/mysql_install_db --user=mysql1
shell> chown -R root:mysql .
shell> chown -R mysql1:mysql data
shell> bin/mysqld_safe --user=mysql &
mysql2 User executed and mysql1 Similar, the difference is to specify different MYSQL_HOME, different ports and sockets

For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn