Ubuntu: Can#39;t connect to local MySQL server through socket #39;/var/run/mysqld/mysqld.sock#39; (2)(Ubuntu:无法通过套接字/var/run/mysqld/mysqld.sock连接到本地MySQL服务器(2))
问题描述
我有一个 Ubuntu 14.04.在运行 Owncloud 的地方安装了 LAMP 的服务器.我尝试安装 paperwork 但没有成功但这不是问题.
I have a Ubuntu 14.04. server with LAMP installed where an Owncloud is running. I tried to install paperwork which didn't work out but thats not the problem.
重新启动服务器后,我尝试再次访问自己的云,但遇到内部服务器错误.见下图.自己的云错误
After restarting my server I tried to access my owncloud again but I am facing an internal server error. See following picture. Owncloud error
我查看了日志/var/log/apache2/error.log 并且有以下短语:
I looked in the log /var/log/apache2/error.log and theres following phrase:
Lost connection to MySQL server during query' in ...
我尝试重启mysql服务但是出现这个错误:
I tried to restart the mysql service but this error appears:
stop: Unknown instance:
start: Job failed to start
然后我尝试使用 mysql -u root -p
登录到 mysql 并且出现以下错误:
Then I tried to login to mysql with mysql -u root -p
and follorwing error appears:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
我用 find/-type s
在机器上寻找套接字,套接字在那里: /run/mysqld/
.我创建了一个符号链接并将其粘贴到 /var/run/mysqld/mysqld.sock
I've looked for the sockets on the machine with find / -type s
and the socket was there: /run/mysqld/
.
I created a symbolic link and pasted it to /var/run/mysqld/mysqld.sock
不幸的是没有任何效果.再次重新启动后,我再也找不到套接字 find/-type s
的输出是:
Unfortnutely nothing worked. After restarting again I can't find the socket anymore the output of find / -type s
is:
/dev/log
/run/php5-fpm.sock
/run/udev/control
find: `/proc/977/task/977/fd/5': No such file or directory
find: `/proc/977/task/977/fdinfo/5': No such file or directory
find: `/proc/977/fd/5': No such file or directory
find: `/proc/977/fdinfo/5': No such file or directory
更新
我已经重新安装了服务器,所以问题解决了 :D
I've reinstalled the server so problem is over :D
推荐答案
如果你安装了lampp服务器,先运行mysql
If you install lampp server, run mysql first
sudo /opt/lampp/lampp startmysql
然后在/var/run 中创建mysqld"目录
Then make "mysqld" directory in /var/run
cd /var/run
sudo mkdir mysqld
将你的mysql从lampp链接到/var/run/mysqld
Link your mysql from lampp to /var/run/mysqld
sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock
运行 mysql -u root -p
.希望能帮到你
run mysql -u root -p
. hope may help you
这篇关于Ubuntu:无法通过套接字'/var/run/mysqld/mysqld.sock'连接到本地MySQL服务器(2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Ubuntu:无法通过套接字'/var/run/mysqld/mysqld.sock&
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- SQL 临时表问题 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01