duanlei2458 2015-02-18 10:05
浏览 56

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

I have installed xampp in my linux server. 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!
  • 写回答

1条回答 默认 最新

  • dougou1943 2017-03-13 19:30
    关注

    I had similar problem on a CentOS VPS. If MySQL won't start or keeps crashing right after it starts, try these steps:

    1) Find my.cnf file (mine was located in /etc/my.cnf) and add the line:

    innodb_force_recovery = X

    replacing X with a number from 1 to 6, starting from 1 and then incrementing if MySQL won't start. 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.

    2) Restart MySQL service. Only SELECT will run and that's normal at this point.

    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.

    4) Move (or delete!) only the bd's directories inside /var/lib/mysql, preserving the individual files in the root.

    5) Stop MySQL and then uncomment the line added in 1). Start MySQL.

    6) Recover all bd's dumped in 3).

    Good luck!

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP