Database configuration
Build the database file set in the MySQL home directory
mkdir data_3307mkdir data_3308mkdir data_3309
Configure the database in the MySQL home directory
./scirpt/mysql_install_db --datadir=/home/fanbin/code/mysql/data_3307 --User=mysql./script/mysql_install_db --datadir=/home/fanbin/code/mysql/data_3308 --User=mysql ./script/mysql_install_db --datadir=/home/fanbin/code/mysql/data_3309 --User=mysql
Multi-instance Boot configuration file
[Mysqld_multi]mysqld=/home/fanbin/code/mysql/bin/mysqld mysqladmin=/home/fanbin/code/mysql/bin/mysqladmin user=Root [mysqld3307]socket=/tmp/mysql_3307.sock port=3307 datadir=/home/fanbin/code/mysql/data_3307/ user=MySQL [mysqld3308]socket=/tmp/mysql_3308.sock port=3308 datadir=/home/fanbin/code/mysql/data_3308/ user=MySQL [mysqld3309]socket=/tmp/mysql_3309.sock port=3309 datadir=/home/fanbin/code/mysql/data_3309/ user=MySQL
Start the database
Starting multiple instances in the Bin directory
./mysqld_multi --defaults-file=/home/fanbin/code/mysql/my_multi.cnf start 3307,3308,3309
Other
Set a new password mysqladmin-uroot - S/tmp/mysql_3307.Sock password123456Log in to the database MySQL-uroot - S/tmp/mysql_3307.Sock- PConfirm the logged in database show variables like'%datadir% '; Check the userSelectUser,host from MySQL.User; Change all root password update userSetPassword=Password' 123456 ')whereUser=' Root '; Change where host is%Update userSetHost= '% ' whereUser= ' Root ' andHost= ' HP '; FLUSH privileges; Check permissions MySQL>Show grants for root; Create user grantSelect on *.* to[Email protected]'% 'Identified by ' Fanbin 'Change the new Add User Password update userSetPassword=Password' 123456 ')whereUser=' Fanbin '; FLUSH privileges;
MySQL Startup multi-instance