PDA

View Full Version : Copying database from debian to windows.


Sylaei
10-22-2009, 07:59 PM
I am exporting my database from a debian box, using phpmyadmin, webmin or mysqldump. I am able to import the database to a windows box, but I lose all the items that my characters have on them. Some of the items are custom some are not.

Any clues?

The game version is 1129. It is the same on both boxes.

I think that this is mysql issue but can't find anything.

Thanks,

Shin Noir
10-22-2009, 08:53 PM
http://www.pantz.org/software/mysql/mysqlcommands.html

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql
to put in english, let's say you want to save the sql dump in /home/sylaei/bob.sql and your DB is named bob, and you use the username/pass of sylaei/uber" :
mysqldump -u sylaei -puber --databases bob > /home/sylaei/bob.sql
You may not need the mysqldir/bin/ part assuming your path is properly added.


Restore database (or database table) from backup.

# [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

This works in windows too, though I normally just windows key + r cmd, cd\<dirofsqlfile>, mysql -u username -p <press enter>
type in password, then "use dbname;" then "source <sqlfilenmae>".
Assuming you save it to uhh, c:\bob.sql, here's another example with same sort of syntax, assuming you added sylaei on this account with permissions to make a db etc.:
start up command line.

Before doing this I'd open up your bob.sql in a smart editor to make sure the first line doesn't "create database bob;" I forget if a dump will recreate your db's or not, I don't think it does though!
c:\
cd\
mysql -u sylaei -p
uber
create database bob;
use bob;
source bob.sql

That would take your copy of bob.sql and make it on your new box.
Make sure when you installed MySQL on Windows you had the option of adding a PATH directory, as without it you can't run mysql from any dir.

I don't mess with phpmyadmin and other tools so much, they're nice for optimization and quick overview but for backup/restore the mysql CLI is pretty sexy and simple.

That's all off memory, so yeah. Hope it helps!

Kilralpine
10-24-2009, 10:27 PM
mysqladmin is available for both platforms and easily lets you do full SQL dumps and imports. Just go to backup and make sure every table is selected.