4 ways to start mysql

There are 4 ways to start mysql: mysqld, mysql_safe, mysql_multi, service mysql start

1. mysqld: It is the core program of mysql, which is used to manage mysql database files and user request operations. mysqld can read the [mysqld] section in the configuration file


[mysqld]
user=mysql
basedir = /usr/local/mysql
datadir = /data/mysql/mysql_3306/data
port=3306
socket = /tmp/mysql.sock
event_scheduler = 0

mysqld startup command: bin/mysqld --defaults-file=/etc/my.cnf &


2. mysqld_safe startup: equivalent to one more daemon process, mysqld will automatically pull up the mysqld process when it hangs
 
  1. The configuration part that can be read [mysqld], [server], [myslqd_safe], in order to be compatible with mysql_safe, the configuration in [safe_mysqld] will also be read
  2. The mysqld called can be specified in [mysqld_safe] with -mysqld, --mysqld-version
mysqld_safe startup command: mysqld_safe --defaluts-file=/etc/my.cnf &

3. mysqld_multi start

is a script used to manage multi-instance startup. Reading [mysqld_multi],[mysqldN] N in the configuration file requires an integer, which is recommended to be represented by the port number. This part of the configuration will override the configuration in the [mysqld] section
  [mysqld_multi] parameter
   [mysqld_multi]
   mysqld = /usr/local/mysql/bin/mysqld_safe
   mysqladmin=/usr/local/mysql/bin/mysqladmin
   user=multiadmin
   password=multipass
mysqld_multi start command: mysqld_multi start 3306

4. serverice mysql start start

This startup must first copy the mysql.server file to the /etc/init.d directory before it can be used
[root@zw-test-db mysql]# cp support-files/mysql.server /etc/init.d/mysql

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish