1.mysqld: mysql server
[root@test bin]# ./mysqld --user=mysql &[root@test bin]# ps -ef|grep mysql |grep -v grep mysql 11165 11100 2 01:06 pts/1 00:00:00 ./mysqld --user=mysql
mysqld有很多参数选项,可以使用以下命令查看所有的选项列表:
shell> mysqld --verbose --help
2.mysqld_safe: mysqld启动脚本
建议使用mysqld_safe启动mysql,mysqld_safe加入了一些安全特性,比如发生错误时重启mysql server、将运行时日志记录到错误日志文件。mysqld_safe会读取my.cnf中的[mysqld]、[server]、[mysqld_safe]部分的配置信息。此外,为了向后兼容,还会读取[safe_mysqld]部分的配置信息,不过现在的版本中都应该写成[mysqld_safe]。[root@test bin]# ./mysqld_safe --user=mysql &[1] 11482[root@test bin]# 151217 01:16:00 mysqld_safe Logging to '/var/mysql/data/dbtest.err'.151217 01:16:00 mysqld_safe Starting mysqld daemon with databases from /var/mysql/data[root@test bin]# ps -ef|grep mysql|grep -v greproot 11482 11100 0 01:15 pts/1 00:00:00 /bin/sh ./mysqld_safe --user=mysqlmysql 11632 11482 3 01:15 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/mysql/data/dbtest.err --pid-file=/var/mysql/data/dbtest.pid# 使用mysqld_safe启动mysql server后,mysqld异常终端后,会自动重启[root@test bin]# kill -9 11632[root@test bin]# ./mysqld_safe: line 166: 11632 Killed nohup /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/mysql/data/dbtest.err --pid-file=/var/mysql/data/dbtest.pid < /dev/null >> /var/mysql/data/dbtest.err 2>&1151217 01:16:17 mysqld_safe Number of processes running now: 0151217 01:16:17 mysqld_safe mysqld restarted[root@est bin]# ps -ef|grep mysql|grep -v greproot 11482 11100 0 01:15 pts/1 00:00:00 /bin/sh ./mysqld_safe --user=mysqlmysql 11673 11482 5 01:16 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/mysql/data/dbtest.err --pid-file=/var/mysql/data/dbtest.pid
3.mysql.server: mysqld启动脚本
mysql.server也是通过调用mysqld_safe脚本来启动mysql server[root@test bin]# ./mysql.server startStarting MySQL[ OK ][root@test bin]# ps -ef|grep mysql|grep -v greproot 11783 1 0 01:23 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/var/mysql/data --pid-file=/var/mysql/data/dbtest.pidmysql 11948 11783 2 01:23 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/mysql/data/dbtest.err --pid-file=/var/mysql/data/dbtest.pid
4.mysqld_multi: 管理多个mysql server