Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a Ubuntu 12.04 LTS Virtual Machine. Last week, the VM stopped unexpectedly now mysql will not start on the VM. These two events may be related, they may not be.

When I try to connect:

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

Then:

$ sudo service mysql start
start: Job failed to start

And

$ dmesg

[ 1838.218400] type=1400 audit(1374633238.253:50): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=18473 comm="apparmor_parser"
[ 1838.358656] init: mysql main process (18477) terminated with status 1
[ 1838.358695] init: mysql main process ended, respawning
[ 1839.269303] init: mysql post-start process (18478) terminated with status 1

And

$ service mysql status
mysql stop/waiting

I think this means mysql is crashing when it starts:

$ sudo mysqld start
130723 21:51:24  InnoDB: Assertion failure in thread 3064211200 in file fut0lst.ic line 83
InnoDB: Failing assertion: addr.page == FIL_NULL || addr.boffset >= FIL_PAGE_DATA
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
02:51:24 UTC - mysqld got signal 6 ;

Per the manual, I went to the data directory (/var/lib/mysql) and ran this:

myisamchk --silent --force */*.MYI

Then:

$ sudo mysqld
...
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
...

Is my database corrupt? What can I do to recover? Re-install mysql? Something less drastic? I'm fine with losing the database, I just want a working system.

share|improve this question
    
It seems like the innodb tables are corrupt. –  John Naegle Jul 24 '13 at 3:05
    
It seems my database was corrupt and prevented mysql from starting. Per the manual, I added this to /etc/mysql/my.cnf: [mysqld] innodb_force_recovery = 6. When I restarted the server, it started without crashing. –  John Naegle Jul 24 '13 at 3:15
    
Ah okay, good to know. –  CS. Jul 24 '13 at 3:16
    
My database doesn't seem to be usable yet - but at least I think I know the issue. I'm going to re-install mysql and see if the problem is fixed. –  John Naegle Jul 24 '13 at 3:26

3 Answers 3

Recreating the mysqld.sock file might do the trick.

 cd /var/run/mysqld
 sudo touch mysqld.sock
 sudo chown mysql:mysql mysqld.sock
 sudo chmod 1777 mysqld.sock
 sudo service mysql restart

If not, please do the following and post the results:

 cd /var/run/mysqld
 ls -al
share|improve this answer
    
Didn't work. "sudo service mysql restart" -- "stop: Unknown instance: start: Job failed to start". /var/run/mysqld has "rwxrwxrwt 1 mysql mysql 0 Jul 23 22:01 mysqld.sock" –  John Naegle Jul 24 '13 at 3:04
    
Never mind, in light of your new info above, this isn't the issue. –  CS. Jul 24 '13 at 3:16

A broken MySQL install can sometimes be worked around by starting in safemode.

Important Running MySQL in safemode lowers the security settings, potentially allowing another person access to your data.

To start in safe mode, run:

sudo /usr/bin/mysqld_safe --user=mysql --skip-grant-tables

If you find that your tables are in fact corrupt, there are several steps that can be taken to fix them. Here is a link to a good tutorial. http://tech.amikelive.com/node-36/mysql-50-recovering-crashedcorrupted-innodb-database/

http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/

share|improve this answer

Check in my.cnf, look for folder tmp location. Then check that location's permissions to be 777. Becuas the default permissions of folders is 755 and form tmp it should be 777.

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.