On one server, you can use mysqld_multi to configure multiple Mysql instances to run. Assume that a MYSQL instance is running on the server, and the data directory is varlibmys.
On one server, you can use mysqld_multi to configure multiple Mysql instances to run. Assume that a MYSQL instance is running on the server. The data directory is/var/lib/mys.
On one server, you can use mysqld_multi to configure multiple Mysql instances to run.
Assume that a MYSQL instance is running on the server. The data directory is/var/lib/mysql and the port is 3306. The SOCKET connection file used is located in/tmp/mysql. sock. You can start one or more instances as follows.
1. Create a data directory for the new instance
After the new MySQL instance is started, the directory where the data is located is the directory under which the database files related to the instance are to be put. Suppose I put them in the/var/lib/mysql2 directory.
Mkdir/var/lib/mysql2 create a directory.
Chown mysql/var/lib/mysql2 grant mysql user permissions.
2. Create a database
This step initializes the database under the Created directory.
Bin/mysql_install_db -- user = mysql -- datadir =/var/lib/mysql2 // install mysql and other system databases to the directory where the instance is ready to run.
3. Configuration File
Modifying the configuration file my. cnf is also the most important step. It is mainly to reset the pid-file, socket, port and other attributes of each instance. My configuration file is as follows: