Ubuntu - 12.04 - MySql 不会使用 service mysql start 启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18138911/
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 18:29:31  来源:igfitidea点击:

Ubuntu - 12.04 - MySql won't start by using service mysql start

mysqlubuntu

提问by Jesse

The only way I was able to get MySql to start was to issue:

我能够启动 MySql 的唯一方法是发出:

mysqld

mysqld

When I issued this command, it started rolling back some database transactions that were conflicted. I have tried issuing

当我发出这个命令时,它开始回滚一些有冲突的数据库事务。我试过发行

service mysql stop

服务 mysql 停止

and all I get is

我得到的只是

Unknown instance:

未知实例:

Now when I try to upload anything to WordPress I get a HTTP 500 error. I am assuming this is because MySQL is running under a different user. Any thoughts on how to get this working again?

现在,当我尝试将任何内容上传到 WordPress 时,出现 HTTP 500 错误。我假设这是因为 MySQL 在不同的用户下运行。关于如何让这个再次工作的任何想法?

回答by Dave Horner

MySql does not start when disk space is full, and does not give a detailed error message. To check the free space on the server run:

当磁盘空间已满时,MySql 不会启动,并且没有给出详细的错误信息。要检查服务器上的可用空间,请运行:

 df -h /

回答by augusto

try

尝试

mysqld --verbose

for more details

更多细节

回答by Joshua D. Boyd

service mysql stopwill only work if mysql was started by one of the service start methods, such as service mysql startor start mysql, or /etc/init.d/mysqld start. If you start mysql by launching the daemon directly without using upstart or init.d, then that is why you get the "unknown instance" error. Of course, all of those valid options probably need to be prefixed with sudoif you aren't logged in as root.

service mysql stop仅当 mysql 由服务启动方法之一启动时才有效,例如service mysql startor start mysql、 or /etc/init.d/mysqld start。如果您通过直接启动守护程序而不使用 upstart 或 init.d 来启动 mysql,那么这就是您收到“未知实例”错误的原因。当然,sudo如果您不是以 root 用户身份登录,所有这些有效选项可能都需要加上前缀。

Before worrying about the wordpress 500 error, I would first make sure that mysql is started correctly. If it is still running stop it with the killcommand. Then, try sudo service mysql start. Then, use ps -efto see if mysql is running. If not, check the mysql log files (EDIT: also check dmesg). If it is running, try to connect to it with the the mysqlcommand and the credentials in your wordpress config.phpfile. If that doesn't work, figure out what is wrong there. If it does work, then check the wordpress (really apache most likely), log file.

在担心 wordpress 500 错误之前,我首先要确保 mysql 已正确启动。如果它仍在运行,请使用kill命令停止它。然后,尝试sudo service mysql start。然后,使用ps -ef查看mysql是否正在运行。如果没有,请检查 mysql 日志文件(编辑:还要检查 dmesg)。如果它正在运行,请尝试使用mysql命令和 wordpressconfig.php文件中的凭据连接到它。如果这不起作用,请找出那里出了什么问题。如果它确实有效,然后检查wordpress(最有可能是apache),日志文件。

See also: https://askubuntu.com/questions/125686/mysql-fails-to-start-after-upgrade-installation-etc

另见:https: //askubuntu.com/questions/125686/mysql-fails-to-start-after-upgrade-installation-etc

回答by microman3000

I know the thread is old but I found it when trying to find a solution to the same problem. Just want to add my 5 cents. It may help someone else.

我知道该线程很旧,但我在尝试找到相同问题的解决方案时找到了它。只想加上我的 5 美分。它可能会帮助别人。

After hunting for and trying various solutions, without the drastic uninstall and purge, my solution was ridiculously simple.

在寻找并尝试了各种解决方案之后,没有剧烈的卸载和清除,我的解决方案非常简单。

My disk was full! I can't believe I didn't check that first. Cleared it out and hey presto!

我的磁盘已满!我不敢相信我没有先检查。清除它,嘿快!

回答by srowland

I had these exact symptoms on Ubuntu 14.04. The mysql --verbose trick yielded "Killed". I ran a dmesg which showed Out Of Memory. So I guess this can be caused by any system resource shortage. I also had nothing in the logs. I increased the memory in the machine and mysql started first time!

我在 Ubuntu 14.04 上有这些确切的症状。mysql --verbose 技巧产生了“杀死”。我运行了一个显示内存不足的 dmesg。所以我想这可能是由任何系统资源短缺引起的。我也没有在日志中。我增加了机器内存,mysql第一次启动!

回答by PUSHPRAJ KUMAR

I have the same issue with MY-SQL on Ubuntu-14.04. I fixed the issue by commenting configuration in /etc/mysql/my.cnf file.

我在 Ubuntu-14.04 上的 MY-SQL 也有同样的问题。我通过评论 /etc/mysql/my.cnf 文件中的配置解决了这个问题。

innodb_buffer_pool_size=10G

innodb_log_file_size=54M

innodb_buffer_pool_size=10G

innodb_log_file_size=54M

After commenting mysql service runs well..

评论后mysql服务运行良好..

Note :- If you comment these configuration then default configuration will take care the size of buffer pool and log file. So not any issue . But if you want to mention it manually , then provide 80% of your physical memory to buffer pool size. and 25% of buffer pool size to log file.

注意:- 如果您注释这些配置,则默认配置将注意缓冲池和日志文件的大小。所以没有任何问题。但是,如果您想手动提及它,则将 80% 的物理内存提供给缓冲池大小。和 25% 的缓冲池大小到日志文件。

回答by Evan Donovan

Make sure that you are logged in as a user with the privileges to restart mysql. I always use the root user.

确保您以具有重启 mysql 权限的用户身份登录。我总是使用root用户。