Convert MySQL for Windows files to Linux?
I had a Windows XP Home box setup with MySQL, Apache, bind9, phpBB.
Then one evening while preparing a Linux replacement my Windows XP Home tower died. It completely croaked. It won't boot up past POST at all. No beep codes or anything! It just sits there with the power on like a brick. I cannot boot it to grab the database through the webserver with any web based MySQL script system. I also do not have another Windows box that I can install MySQL on. There is no possible way I have to retrieve any MySQL databases that I had on it except by mounting the hard drive where MySQL stored the databases for Windows on it. I've Googled for hours on end trying to find a solution but to no avail. I tried simply copying the contents of the database as-is from where it was on Windows to where it would be on Linux but when I try to browse the phpBB forums I get this error: Quote:
Is there any way I can convert the MySQL database directory from Windows version to Linux? |
Sure, it's easy:
1. In general you should backup your MySQL database MySQL backups are a simple, clear-text "dump" format. 100% portable to any platform - easy to make, easy to restore. Q: Did you happen to make a backup before you crashed? 2. If not, fear not! It should be easy to recover using your binary database files, too. The easiest way to do this is: a) get a PC that's working b) Install the SAME VERSION of Windows c) Install the SAME VERSION of MySQL for Windows d) Turn the PC off, open the case, and plug in the hard drive from your failed PC. e) Reboot the PC. Make sure the drive mounts in Windows. f) Mount your files in MySQL 3. Finally, I'm *not* sure you can necessarily mount MySQL datafiles created on a Windows system to a MySQL running on Linux. But you can certainly TRY. This link is EXTREMELY useful: http://www.kimvette.org/linux/recove...after_recovery 'Hope that helps .. PSM |
Quote:
All I have is the box I've got Ubuntu Studio Lucid installed on. I've already spent alot of time on it and I really don't want to wipe the harddrive on 4 days+ work on it. :( |
Dude -
What ELSE did I suggest? Did you try it? Did you READ it? And don't whine about "not having another PC". If it's really important enough, perhaps you can GET permission (permission, that is, from whoever won't "allow" you to install MySQL) PS: *Did* you read my other suggestions? Did any of them work/are any of them feasible? |
Quote:
MySQL said it doesn't know what 'InnoDB' is. I Googled the error for InnoDB and the Google search results gave posts about commenting out the MySQL ini/conf file line for skipping InnoDB support but I couldn't find it in my conf files. |
Hi -
From your first post, I understood: a) You had two systems: Windows XP, and Ubuntu Linux. b) Your Windows XP system croaked, but your Ubuntu system is alive and well. c) Your goal is to migrate the MySQL data from the failed Windows system to your working Ubuntu system. Q: Is this correct? Q: Do you have a MySQL backup (i.e. clear-text schema and data dump) that you can simply restore to your working system? Q: Have you tried the procedure I cited above: http://www.kimvette.org/linux/recove...after_recovery It's admittedly a different system - and probably a much older version of MySQL than the one you're running now. But exactly what did you try? Exactly what didn't work? Exactly what error message did you encounter? Unfortunately, "MySQL said it doesn't know what 'InnoDB' is..." is too vague to be useful. Please be more specific about a) what exactly you did (step-by-step), and b) the exact error message (ideally, cut/paste it from your terminal window). Q: Exactly what version of Ubuntu are you running? Exactly what version of Linux/MySQL? Do you recall your Windows version of MySQL? Q: How exactly did you try "copying" the data from Windows to Linux? Q: Have you tried physically mounting the old hard drive in your Linux system, and mounting it as a Windows/CIFS filesystem? Can you see the data from Linux? |
2 Attachment(s)
Quote:
Quote:
Quote:
Code:
user@HomeServer:~$ su Quote:
Attachment 4103 Quote:
Attachment 4102 Quote:
Quote:
Code:
root@HomeServer:/etc/mysql/conf.d# mysql --version Code:
------------------------------------------------------------ Quote:
|
for fun i had a site running on a fedora and win xp ( dual boot) using the SAME database ( weel the same files
I just used a startup script to copy the mysql files to the linux mysql folder set the correct ownership and SE context just make sure that the linux mysql db is the same exact version that was on windows . |
Hi, JohnVV - thanx for the input!
Hi, thinktink - Have you tried this: Quote:
Please try connecting to MySQL directly from the command prompt (e.g. "mysql -uROOT -pROOT_PASSWORD mysql"), and let us know what happens. |
Code:
show variables like 'have_innodb'; Quote:
Code:
mysql> show variables like 'have_innodb'; |
Thinktink -
1. Please forget mysqladmin for now: please just use the mysql command line until we're sure "everything's working". 2. Please read the link I posted here. Please edit your my.cnf, reboot your system, and verify that InnoDB is ENABLED. As the link says, it's often NOT enabled by default on Debian. 3. Please re-read the link I posted here. Please see a) do you get past the "Error 1286", and b) if you're able to access the data you copied from Windows (if only from the mysql command prompt). 4. Please post back what you find. TIA .. PSM |
Quote:
Quote:
Code:
root@homeserver:~# cd /etc/mysql Quote:
b) I don't know much at all about mysql queries or how to try to access databases from the "mysql" command line, that's why I'm using myadmin to test it. I am sorry about that. How do I do that? |
Sigh...
Sorry this is causing you so much grief - it SHOULD ordinarily be a slam dunk. Honest :( SUGGESTIONS: 1. Search for a duplicate my.cnf: http://www.experts-exchange.com/Data..._20921250.html [code]find / -name my.cnf -print > /dev/null[/quote] 2. Your goal, of course, is to get InnoDB ENABLED: Code:
mysql -uXXX -pYYY mysql http://forum.slicehost.com/comments....cussionID=1754 Q: What is your exact distro and version? 4. Here's another good suggestion: http://www.geedew.com/2008/05/21/how...-mysql-server/ Quote:
5. In any case, if you don't find a "rogue my.cnf" on your system, please try Googling for "enable InnoDB" (or something similar) and see if you get other hints. It SHOULD work. Honest! 'Hope that helps .. PSM |
Ok, I have found the solution. It does not match the original question of how to convert a MySQL database from Windows to Linux but I have the ultimate goal of recovering the MySQL data from dead Windows XP box. I have probably read alot of the articles you have read over these past days but I guess it just took a bit of time to piece them all together.
...and this time I took detailed notes! I sat down and thought about the goal of not converting but mounting the database as is. I realized, of course, that would not work unless the settings for both source and target installs matched (for the most part) exactly. I then decided to spend some time comparing all the ini files from the source box to the cnf files in the target box. I did a Google search to find a grep command to strip the comment lines out of the config files and redirected the output of each to "oldmysqlserverconf.txt" (source) and "newmysqlserverconf.txt" (target). I then opened both files at the same time in gedit, removed the inactive/sample entries and blank lines, and went to work finding every option in the source configs that either did not match, or did not exist, in the target configs. In my case only one explicitly defined option was different in the target configs, the rest were non-existent in the target configs. While doing that process I came across an option in the source configs that caught my immediate attention: Code:
innodb_data_home_dir="I:/Program Files/MySQL/MySQL Server 5.1/bin/InnoDB Tablespace/" When all my notes were complete I first stopped the MySQL daemon, backed up "my.cnf", opened the original and implemented the changes I notated. That part was easy since the output of the grep command I used also included the line numbers of each uncommented setting, plus there was only one to explicitly change, the rest I just copied and pasted. I then recopied my local database backup (which now included the missing "ibdata1" file) as per the link provided earlier, restarted the MySQL daemon, and checked myPHPAdmin. To my immediate utter consternation it still failed with the same dam'n error code and text [1286]. But about a second later I remembered reading somewhere that InnoDB "log files" (I think it said "log files") that get corrupted will cause the InnoDB engine to fail at startup with no warnings or errors. I looked at the data directory root again and saw "ibdata1", "ib_logfile0", "ib_logfile1", "mysql", "phpbbdb", and "test". I saw that the second and third entries had the word "logfile" in them. I stopped the MySQL daemon and ran this command line: Code:
rm ib_* For reference I am posting my notes. grep comment stripper commands: Code:
cd /etc/mysql Completed target server configuration change notations (the one line that starts with "-->" was the only explicitly defined configuration that was different. The config options at the end that don't start with [filename]:[linenumber]: were the config options that were not explicitly defined in the target configuration files.) Code:
./debian.cnf:2:[client] P.S. The first thing I did after recovering the database was to back it up through MyPHPAdmin, clear the database files in /var/lib/mysql, disable InnoDB support and change the default storage engine to MyISAM, and restore the backup through MyPHPAdmin. Goodbye InnoDB! |
I know it's marked as 'solved' and congratulations. Thanks for the extensive feedback, it might help me one day ;)
Just on a side note: you are aware of the differences between MyIsam and InnoDB tables, most notably related to transactions. So there might be scenarios where one needs InnoDB. |
All times are GMT -5. The time now is 02:58 PM. |