What are the four startup modes of MySQL?
What this article shares to you is about the four ways to start MySQL. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it.
There are four ways to start mysql:
1 、 mysqld
Start the mysql server:. / mysqld-- defaults-file=/etc/my.cnf-- user=root
Client connection:
Mysql-defaults-file=/etc/my.cnf
Or
Mysql-S / tmp/mysql.sock
2 、 mysqld_safe
Start the mysql server:. / mysqld_safe-- defaults-file=/etc/my.cnf-- user=root &
Client connection:
Mysql-defaults-file=/etc/my.cnf
Or
Mysql-S / tm/mysql.sock
3 、 mysql.server
Cp-v / usr/local/mysql/support-files/mysql.server / etc/init.d/
Chkconfig-add mysql.server
Start the mysql server: service mysql.server {start | stop | restart | reload | force-reload | status}
Client connection: same as 1, 2
4 、 mysqld_multi
Mkdir $MYSQL_BASE/data2
Cat / etc/my.cnf
[mysqld_multi]
Mysqld = / usr/local/mysql/bin/mysqld_safe
Mysqladmin = / user/local/mysql/bin/mysqladmin
User = mysqladmin
Password = mysqladmin
[mysqld3306]
Port = 3306
Socket = / tmp/mysql3306.sock
Pid-file = / tmp/mysql3306.pid
Skip-external-locking
Key_buffer_size = 16m
Max_allowed_packet = 1m
Table_open_cache = 64
Sort_buffer_size = 512K
Net_buffer_length = 8K
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8m
Basedir = / usr/local/mysql
Datadir = / usr/local/mysql/data
[mysqld3307]
Port = 3307
Socket = / tmp/mysql3307.sock
Pid-file = / tmp/mysql3307.pid
Skip-external-locking
Key_buffer_size = 16m
Max_allowed_packet = 1m
Table_open_cache = 64
Sort_buffer_size = 512K
Net_buffer_length = 8K
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8m
Basedir = / usr/local/mysql
Datadir = / usr/local/mysql/data2
EOF
# mysql-S / tmp/mysql3306.sock
Mysql > GRANT SHUTDOWN ON *. * TO 'mysqladmin'@'localhost' identified by' mysqladmin' with grant option
# mysql-S / tmp/mysql3307.sock
Mysql > GRANT SHUTDOWN ON *. * TO 'mysqladmin'@'localhost' identified by' mysqladmin' with grant option
Start the mysql server:. / mysqld_multi-- defaults-file=/etc/my.cnf start 3306-3307
Shut down the mysql server: mysqladmin shutdown
These are the four ways to start MySQL, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.