Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

MySQL was not starting. I backed up /var/lib/mysql/*. I uninstalled MySQL and reintalled it. It started again. I copied everything back to /var/lib/mysql. I restarted the service. I logged in and could see all of my tables. When I try to view their contents, I get:

Table 'tablename' doesn't exist

Is there something I need to do to make MySQL recognize the files I copied back into the /var/lib/mysql/ folder?

Any help is appreciated, I'm dying here.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Check permissions, make sure ownership and permissions are correct on /var/lib/mysql. This is typically mysql. If this is not the issue, produce output of your .err log file.

Try the following to correct permissions:

chown -R mysql:mysql /var/lib/mysql
find /var/lib/mysql -type d -exec chmod 770 {} \;
find /var/lib/mysql -type f -exec chmod 660 {} \;

The error log is located in the data directory, which appears to be /var/lib/mysql in your case. Verify in your cnf file.

share|improve this answer
    
I ran chmod -R 777 /var/lib/mysql/ and still had the same problem. Where is the mysql error log located in a standard Ubuntu install? –  Kirk Sep 21 '10 at 20:56
    
Bad idea, should almost never have public writable stuff. Check out my edit. –  Warner Sep 21 '10 at 21:13
    
Thanks for the tweak on permissions. On closer inspection I found that some of my tables existed, and others didnt. Looks like data corruption killed the tables that weren't being found.I found a backup of everything and reimported the data from the backup (thank goodness!). –  Kirk Sep 21 '10 at 21:19
    
I'm glad everything worked out! –  Warner Sep 21 '10 at 22:01

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.