Ad Widget

Collapse

Ubuntu 10.04 - upgrade to MYSQL causing " Can't connect to local MySQL server"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alex_B
    Junior Member
    • Mar 2012
    • 2

    #1

    Ubuntu 10.04 - upgrade to MYSQL causing " Can't connect to local MySQL server"

    Hello

    Ive had Zabbix 1.8.1 running on Ubuntu 10.04 for some time now and has been working great. I've just applied some recent updates (which included mysql updates.. and stupidly I did not run snapshot of the server (or recent backup) beforehand).. Ever since I cannot gain access to Zabbix due to mysql connect errors:

    mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)[/usr/share/zabbix/include/db.inc.php:58]

    This points to mysql not running but it is running and I can confirm processing information.

    when I restart the mysql service I can initially connect the one time using commandline mysql.. but trying again gives similar error to above on the commandline:

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

    Ive recearched the error and possibly looking to permission errors but im not sure where. Ive adjusted the mysql config file but to no avail. mysql looks to be there and appears to be working it appears to be some communication from the local console.

    If anyone has any pointers that would be great..
  • justinc
    Junior Member
    • Aug 2011
    • 20

    #2
    anything interesting in:
    /var/lib/mysql/<hostname>.err

    Comment

    • Alex_B
      Junior Member
      • Mar 2012
      • 2

      #3
      Actually nothing in there - probably need to turn my loging up. All errors appear to be here /var/log/mysql/error.log

      Turn out I have fixed the issue.
      check out this link. http://www.softwareprojects.com/reso...nodb-1634.html

      Has a lot of info on recovering Mysql

      I had to do number 7.. I could get access to mysql dialog direct after a restart so:

      Step 1: Add this line to your /etc/my.cnf configuration file:

      Code:
      [mysqld] 
      innodb_force_recovery = 4
      Step 2: Restart MySQL. Your database will now start, but with innodb_force_recovery, all INSERTs and UPDATEs will be ignored.

      Step 3: Dump all tables

      mysqldump --force --compress --triggers --routines --create-options -uUSER -pPASSWORD --all-databases > /home/yourhome/databases.sql


      Step 4: Shutdown database and delete the data directory.

      i moved folder so:
      Code:
      sudo mv /var/lib/mysql /var/lib/mysql.old
      Step 5: Run mysql_install_db to create MySQL default tables

      Step 6: reset your root password back or a different one
      Code:
      mysqladmin -u root password NEWPASSWORD
      Step 7: restore all databases back.
      Code:
      mysql -u root -p </home/yourhome/databases.sql

      This worked well.

      Comment

      Working...