Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.