Mysql migration on hdd to hdd..

eFex

New member
Joined
Sep 21, 2010
Messages
4
Hello,

I have a problem with harddisk.
I have two harddisk. One of the oldest (/dev/sdb2 | Mounted on /tmp) and system files have been damaged.
The other is (/dev/mapper/VolGroup00-LogVol00) new and installed new systems. I want to move my mysql databases to new harddisk from old harddisk.
I moved databases files from /tmp/var/lib/mysq/*_* to /var/lib/mysql but it did not work!
I get these error messages in some tables from phpmyadmin: #29 - File './*_*/*.MYD' not found (Errcode: 2)

Regards
eFex
 
or how I can get full backup from corrupt system (old hdd not running) via ssh..
 
You can try mysqldump.

mysqldump -uda_admin -p --all-databases > /root/alldatabases.sql

You then need to enter the password as in /usr/local/directadmin/scripts/setup.txt -> the one at adminpass

Possible you need to 'locate mysqldump' if its not working without the full path

when found use it like:

/usr/local/mysql-5.1.50-linux-x86_64/bin/mysqldump -u ..
 
You can try mysqldump.

mysqldump -uda_admin -p --all-databases > /root/alldatabases.sql

You then need to enter the password as in /usr/local/directadmin/scripts/setup.txt -> the one at adminpass

Possible you need to 'locate mysqldump' if its not working without the full path

when found use it like:

/usr/local/mysql-5.1.50-linux-x86_64/bin/mysqldump -u ..

This won't work because it requires mysql to be running. It sounds like his old mysql data is simply on a drive, but not the active running mysql instance.
 
eFex, what method did you use to copy the files from /tmp/var/lib/mysql/ to /var/lib/mysql/?

Could you do a ls -lah /var/lib/mysql/ and post the result here?

We need to make sure the .MYD files actually exist. If they do, we need to check if the files are owned by the correct user. Depending on how you copied the files, they might be owned by root, when they should be owned by the mysql user/group.
 
[root@server921 mysql]# ls -lah /var/lib/mysql/
total 134M
drwx------ 2 mysql mysql 4.0K Sep 21 02:40 pimp_bull

I copied using with WinSCP (SFTP).
I changed the folder permissions myself.

some .MYD files in the folder does not exist in table folder.
 
I made empty .MYD file myself into a tables folder.
The script seems to be working properly now.
Is they creates a problem later?
 
The MYD file is pretty much all the data for your database. Is your application able to view the old data?

Have you tried any utilities such as myisamchk ?
 
Back
Top