无法在 ubuntu 中启动 mysql 服务器

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

Unable to start the mysql server in ubuntu

mysqlubuntu-16.04

提问by Rohit Kumar

After running the command mysql -vin Ubuntu, I am getting the following error:

mysql -v在 Ubuntu 中运行命令 后,我收到以下错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

ERROR 2002 (HY000): 无法通过 socket '/var/run/mysqld/mysqld.sock' 连接到本地 MySQL 服务器 (2)

回答by Dmitri Sandler

I think this is because you are using client software and not the server.

我认为这是因为您使用的是客户端软件而不是服务器。

  • mysqlis client
  • mysqldis the server
  • mysql是客户
  • mysqld是服务器

Try: sudo service mysqld start

尝试: sudo service mysqld start

To check that service is running use: ps -ef | grep mysql | grep -v grep.

要检查服务是否正在运行使用:ps -ef | grep mysql | grep -v grep

Uninstalling:

卸载:

sudo apt-get purge mysql-server
sudo apt-get autoremove
sudo apt-get autoclean

Re-Installing:

重新安装:

sudo apt-get update
sudo apt-get install mysql-server


Backup entire folder before doing this:

在执行此操作之前备份整个文件夹:

sudo rm /etc/apt/apt.conf.d/50unattended-upgrades*
sudo apt-get update
sudo apt-get upgrade