Linux平台MySQL启动关闭方式总结

发表于:2016-7-21 10:10

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:潇湘隐者    来源:51Testing软件测试网采编

  MySQL的启动方法有很多种,下面对比、总结这几种方法的一些差异和特性,下面实验的版本为MySQL 5.6。如有疏漏或不足,敬请指点一二。
  1:使用mysqld启动、关闭MySQL服务
  mysqld是MySQL的守护进程,我们可以用mysqld来启动、关闭MySQL服务,关于mysqld, MySQL 5.6官方介绍资料如下所示:
  mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files.
  When MySQL server starts, it listens for network connections from client programs and manages access to databases on behalf of those clients.
  The mysqld program has many options that can be specified at startup. For a complete list of options, run this command:
  shell> mysqld --verbose --help
  MySQL Server also has a set of system variables that affect its operation as it runs. System variables can be set at server startup, and many of them can be changed at runtime to effect dynamic server reconfiguration. MySQL Server also has a set of status variables that provide information about its operation. You can monitor these status variables to access runtime performance characteristics.
  如果MySQL是rpm方式安装的话,mysqld位于/usr/sbin下,如果MySQL是二进制安装的话,mysqld则位于bin目录下面。
[root@localhost ~]# whereis mysqld
mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz
[root@localhost ~]# /usr/sbin/mysqld stop
2016-06-27 14:52:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-27 14:52:54 9315 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2016-06-27 14:52:54 9315 [ERROR] Aborting
2016-06-27 14:52:54 9315 [Note] Binlog end
2016-06-27 14:52:54 9315 [Note] /usr/sbin/mysqld: Shutdown complete
[root@localhost ~]# /usr/sbin/mysqld start
2016-06-27 14:52:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-27 14:52:59 9316 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2016-06-27 14:52:59 9316 [ERROR] Aborting
2016-06-27 14:52:59 9316 [Note] Binlog end
2016-06-27 14:52:59 9316 [Note] /usr/sbin/mysqld: Shutdown complete
  2:使用mysqld_safe启动、关闭MySQL服务
  很多时候,人们会纠结mysqld与mysqld_safe的区别. 其实mysqld_safe是一个脚本,一个非常安全的启动、关闭MySQL服务的脚本。它实际上也是调用mysqld来启动、关闭MySQL服务。关于mysqld_safe,可以参考官方文档mysqld_safe — MySQL Server Startup Script
 
21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号