I had to reinstall a mysql server on Ubuntu 10.04 and it gave me headaches for hours. At first I couldn't log in for no apparent reason. Then I couldn't login when I started mysql-server with --skip-grant-tables. Then I continued looking and saw some problems with tmp rights which I fixed by:
chown root:root /tmp chmod 1777 /tmp
After this it still did not work, so I proceeded to look for problems, I purged every single mysql package by running:
aptitude purge mysql-server aptitude purge mysql-common aptitude purge mysql-client
I then reinstalled every package but it still did not work. So I took drastic matters. If you are still stuck, please do this at your own risk. First purge everything as displayed above. Then copy this script:
updatedb locate mysql > tmp.file FILE=tmp.my for fileN in $(cat $FILE) do echo $fileN rm -rf $fileN done
What this script does is:
- updatedb, updates an index file
- locate uses the index file to build a file with all mysql file references
- We open this file, and for every line, which corresponds to a path, echo the filename and delete it.
After saving the script run it as root and reinstall mysql-server with:
aptitude install mysql-server
And you should be ready to go.