MySQL 如何重启mysql服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13473440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:30:36  来源:igfitidea点击:

How to restart mysql server?

mysqlamazon-ec2amazon-web-servicesmysql-pythonbitnami

提问by Madhur Rampal

Every time I restart MySQL server

每次我重新启动 MySQL 服务器时

bitnami@xxx:/$ sudo opt/bitnami/ctlscript.sh start server

?

?

WWarning: World-writable config file '/opt/bitnami/mysql/my.cnf' is ignored
Warning: World-writable config file '/opt/bitnami/mysql/my.cnf' is ignored
121120 12:30:18 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'.
121120 12:30:18 mysqld_safe Starting mysqld daemon with databases from /opt/bitnami/mysql/data
121120 12:30:20 mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/ip-10-136-14-170.pid ended
/opt/bitnami/mysql/scripts/ctl.sh : mysql  could not be started

The server responds with the following error:

服务器响应以下错误:

(2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")

(2002,“无法通过套接字'/tmp/mysql.sock'连接到本地MySQL服务器(2)”)

Please tell me what I have to do fix this issue.

请告诉我我该怎么做才能解决这个问题。

回答by Martin

If mysql is installed as a service (which is most of the time) you can do service mysqld restartor /etc/init.d/mysqld restart.

如果 mysql 安装为服务(大多数情况下),您可以执行service mysqld restart/etc/init.d/mysqld restart.

You can also use start, stopor reloadinstead of restart.

您也可以使用start,stopreload代替restart