I can't log in to my fedora linux because of I/O errors(system halts after grub). Now I want to create a backup from my mysql databases. I tried chroot /path/to/root and then mysqldump, but I get the following error:

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) when trying to connect

I'm using an ubuntu live disk. Why does it show this error? Is there a better way to dump dbs?


Chances are, if you haven't done so, you need to mount the Fedora disk while you use the Ubuntu Live CD. Here is what I would do :

• Mount the Fedora disk : mkdir /mnt/fedora, mount /dev/{hda/sda/etc) /mnt/fedora
• tar/gz your /var/lib/mysql (assuming that is the path) (tar cvz mysql_backup.tgz /var/lib/mysql
• Copy your mysql_backup.tgz to a safe location, e.g. a USB key

Once you do this, you can un tar/gz your mysql directory on a new server and recover your DBs.


My guess is that your mysql daemon is not running. You have to start it using /etc/init.d/mysql start. Then you can dump your databases as proposed.

To answer your question "Is there a better way ..." Yes it is usually better to backup a database before the server crashes, rather than afterwards.

You might be able to copy the flat files. Not sure where they reside on Fedora, but on Ubuntu they are located in /var/lib/mysql/rnews. Files look eg. like <table_name>.MYD or <table_name>.MYI ... etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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