开发者

Reliable Way To Transfer A MySQL Database From My LocalHost To A Hosted Server?

I've just developed a large database, and am trying to put it online. I want to make sure that all the foreign keys, defaults开发者_JS百科, constraints, views etc, are preserved. When I try to export from my development PC using phpMyAdmin and then import on my hosted server, it errors out on all the views. Is there any other way to clone a database?


From the command line in linux, to a linux server, you can:

mysqldump dataBasEnAmE > dump_of_dataBaSeNaMe_2010_3_30.sql

Copy the file to the server, then:

mysql serverDataBaseName < dump_of_dataBaSeNaMe_2010_3_30.sql


If you don't have mysql configured from the command line to accept your user, you may have to specify a user, e.g. root, and put in the database password, so those commands would become:

mysqldump dataBasEnAmE -u root > dump_of_dataBaSeNaMe_2010_3_30.sql

and

mysql serverDataBaseName -u server_root_user < dump_of_dataBaSeNaMe_2010_3_30.sql

respectively.

This is a relatively simple manual backup method as well, depending on the database size.


Yes, there are lots of ways. But I'd strongly recommend using the same vendors import functionality as supplied the export functionality. Do you have access to run mysqldump / mysql at both ends?

OTOH, you may run into file upload limits transferring a large file over HTTP and using PHPMyAdmin. Did you check the export? Have you tried exporting just the relevant database schemas without the application data? Did you export the information schema and mysql databases or just the application database?

You may be a bit premature in deciding that you need to try something esle just because what you tried in PMA failed.

C.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜