ecl*_*sis 3 mysql sockets linux ubuntu
我只是在我的WordPress网站上手动安装了一个新的插件,在MySQL中为插件的条目创建了一个表,当我尝试打开使用该插件的页面时,我收到此错误:
DataTables warning (table id = 'to-do_list'): An error occurred while
connecting to the database 'wordpress_clouse'. The error reported by the
server was: SQLSTATE[HY000] [2002] Can't connect to local MySQL server
through socket '/var/lib/mysql/mysql.sock' (2)
Run Code Online (Sandbox Code Playgroud)
这是我的配置文件中列出的MySQL信息(我认为是正确的):
"type" => "Mysql",
"user" => "root",
"pass" => "******",
"host" => "localhost",
"port" => "",
"db" => "******"
Run Code Online (Sandbox Code Playgroud)
这是/etc/my.cnf文件的主要内容:
# The following options will be passed to all MySQL clients
[client]
#port = 3306
socket = /var/run/mysqld/mysqld.sock
# The MySQL server
[mysqld]
#port = 3306
socket = /var/run/mysqld/mysqld.sock
log_error = mysqld.err
skip-networking
Run Code Online (Sandbox Code Playgroud)
我已经看过类似错误的答案,但没有一个解决方案适合我.任何帮助,将不胜感激.
这是帮助我解决这个问题的原因,那就是我服务器上的实际文件目录是/var/lib/mysql/mysql.sock,而不是/var/lib/mysqld/mysqld.sock:
[client]
部分(如果您没有[client]
部分,则添加它).它应该如下所示:[客户]
插座=的/ var/lib中/ MySQL的/的mysql.sock
错误应该消失了.非常感谢@alvits指出我正确的方向.
归档时间: |
|
查看次数: |
93487 次 |
最近记录: |