[英]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.