简体   繁体   English

无法连接mysql并获取套接字错误

[英]Unable to connect mysql and getting socket error

I have installed xampp in my linux server. 我在我的linux服务器上安装了xampp。 But during connection in command prompt i am getting below error. 但在命令提示符连接期间,我得到以下错误。 Please help me to fix the error. 请帮我修复错误。

linux-pott:/opt/lampp/var/mysql # mysqladmin -u root -p status
Enter password: 
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket'/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!

I had similar problem on a CentOS VPS. 我在CentOS VPS上遇到了类似的问题。 If MySQL won't start or keeps crashing right after it starts, try these steps: 如果MySQL在启动后无法启动或不断崩溃,请尝试以下步骤:

1) Find my.cnf file (mine was located in /etc/my.cnf) and add the line: 1)找到my.cnf文件(我的位于/etc/my.cnf)并添加以下行:

innodb_force_recovery = X innodb_force_recovery = X.

replacing X with a number from 1 to 6, starting from 1 and then incrementing if MySQL won't start. 将数字从1替换为6,从1开始,然后在MySQL无法启动时递增。 Setting to 4, 5 or 6 can delete your data so be carefull and read http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html before. 设置为4,5或6可以删除您的数据,所以要小心并阅读http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html之前。

2) Restart MySQL service. 2)重启MySQL服务。 Only SELECT will run and that's normal at this point. 此时只会运行SELECT,这是正常的。

3) Dump all your databases/schemas with mysqldump one by one, do not compress the dumps because you'd have to uncompress them later anyway. 3)使用mysqldump逐个转储所有数据库/模式,不要压缩转储,因为无论如何你必须在以后解压缩它们。

4) Move (or delete!) only the bd's directories inside /var/lib/mysql, preserving the individual files in the root. 4)仅移动(或删除!)/ var / lib / mysql中的bd目录,保留根目录中的各个文件。

5) Stop MySQL and then uncomment the line added in 1). 5)停止MySQL,然后取消注释1)中添加的行。 Start MySQL. 启动MySQL。

6) Recover all bd's dumped in 3). 6)恢复3)中倾倒的所有bd。

Good luck! 祝好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法连接到mongoDB出现错误 - unable to connect to mongoDB getting error 无法连接到MySQL数据库,套接字错误 - Cannot connect to MySQL database, socket error mysql连接被弃用错误 - mysql connect getting deprecated error 在php stream_socket_client()中获取错误:无法连接到ssl://gateway.sandbox.push.apple.com:2195(连接被拒绝) - getting error in php stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection refused) 无法连接到数据库,不断出现异常错误 - unable to connect to the database keep getting an unusual error 使用mysql_connect()语句获取错误消息 - getting an error message with a mysql_connect() statement 错误:无法通过套接字连接到本地MySQL服务器 - Error: Can't connect to local MySQL server through socket 尝试了所有事情仍然得到 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in mac - Tried every thing still getting ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in mac Java Socket Bridge无法连接 - Java Socket Bridge unable to connect 我正在尝试使用 laravel 发送电子邮件,但出现此错误“stream_socket_client(): 无法连接到 tcp://smtp.gmail.com:587” - I am trying to send email using laravel and i am getting this error “stream_socket_client(): unable to connect to tcp://smtp.gmail.com:587”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM