为什么我无法连接到我的sql数据库?我收到错误消息:“无法通过套接字连接到本地MySQL服务器” [英] Why can't I connect to my sql database? I get the error message: "Can't connect to local MySQL server through socket"

查看:308
本文介绍了为什么我无法连接到我的sql数据库?我收到错误消息:“无法通过套接字连接到本地MySQL服务器”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是将网站移到了新的虚拟主机,更改数据库登录文件后,它仍然无法连接。我收到以下错误:

I just moved my site to a new web host, and after changing the database-login file, it still can't connect. I get the following error:

警告:mysql_query()[function.mysql-query]:无法通过套接字'/ tmp / mysql连接到本地MySQL服务器。在第91行的/usr/www/users/simpleof/index.php中 sock(2)

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/www/users/simpleof/index.php on line 91

我更改了密码并再次尝试,但仍然没有工作。 db-login中的所有信息都是正确的,为什么我不能连接到数据库?

I changed the password and tried again, but it still doesn't work. All the information in the db-login is correct, so why can't I connect to the database?

推荐答案

哇。我感觉很傻,但是登录时我在服务器名称中放了一个多余的空格。

Wow. I feel pretty dumb, but I put an extra space into the server name when I logged in.

因此,我对有此问题的其他人的建议是真的检查以确保您的登录信息正确。

So my advice to anyone else having this problem is REALLY check to make sure your log-in info is correct.

这篇关于为什么我无法连接到我的sql数据库?我收到错误消息:“无法通过套接字连接到本地MySQL服务器”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆