Moving MySQL database from one computer to another
Hello,
I may be asking this in the wrong category but since I use MySQL with PHP I think this is the closest. How can I move MySQL databases from one computer to another? If I simply copy the whole MySQL folders or some of its folders and paste it on the other computer would it be sufficient?
Thanks
Re: Moving MySQL database from one computer to another
it would be best to make a MySQL dump of all the contents. I'm not sure if copying the folders would be good enough.
you can make a MySQL dump using various administration programs/interfaces, including phpMyAdmin (which is what I would suggest). There's also a command that will do this for you, I believe, but it seems to escape me at this time. there was another thread about this a couple of months ago I believe, so if you search this forum for "sql dump" or just "dump," you might be able to find some references.
Re: Moving MySQL database from one computer to another
I will suggest, export all data to SQL (maybe use phpMyAdmin), and import into new database
Re: Moving MySQL database from one computer to another
that's what a MySQL dump is.
Re: Moving MySQL database from one computer to another
Code:
$ mysqldump -u <user> -p<password> <database> > dumpfile.sql
The last > is literal. That's the command on Unix systems.
Re: Moving MySQL database from one computer to another
Re: Moving MySQL database from one computer to another
Quote:
Originally Posted by penagate
please how do i get through this dump on windows?
as the mysqldump returned an empty result.
i have MySQL 5.0.51b
thanks
Re: Moving MySQL database from one computer to another
Quote:
Originally Posted by modpluz
please how do i get through this dump on windows?
as the mysqldump returned an empty result.
i have MySQL 5.0.51b
thanks
This command will produce a mysqldump on Windows:
Code:
"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump" -u myuser --password=mypass mydbname > C:\database.sql
Be sure to change the mysql path to your path and the user/pass.
Re: Moving MySQL database from one computer to another
Did the advice work out for you? Having same troubles.
Re: Moving MySQL database from one computer to another
I editted my post with different code. I have just tested this on my system which worked:
Code:
"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump" -u myuser --password=mypass db > C:\database.sql
That will create an SQL file with the dump in, in c:\
Be sure to change the path to your mysql bin directory. Change myuser to your username, mypass to your password and mydb to your database name.
Re: Moving MySQL database from one computer to another
If you specify the -p option with no password you will be prompted to type it into the standard input of the mysqldump utility which is safer than having it logged in your shell's history.