How to copy database with indexes to new location

时间:2016-04-04 18:00:35

标签: mysql

I have a MySQL database on GoDaddy which I tried to copy over to my home pc (xampp env). I will do some web development work here at home. The export utility supplied by GoDaddy does not copy over indexes.

So I putty’d in and executed mysqldump. It created an SQL file. I used FTP to transfer it to my machine but I still get errors like “Undefined index: index_name in ….” (created database and ran source to digest it - no errors)

I’ve read a couple of posts on the matter and can’t believe pages of SQL are required to obtain these.

QUESTION:

Can I copy the GoDaddy MySQL database in its complete operating form so I can use it locally? All the data is here. So far I’m just missing indexes. Will I have other problems?

1 个答案:

答案 0 :(得分:0)

You can rsync or copy the database to another machine but there are caveats. The machines need to be nearly identical ie both on the same OS etc and using the same version of mysql (I know they don't need to be exactly the same and it will sometimes work with minor version differences but I would not recommend that).

You also need to take the database down to rsync or copy it or you could be copying corrupted data.

mysqldump is the preferred way to do this.

All the information you need with options can be found here...

https://dba.stackexchange.com/questions/174/how-can-i-move-a-database-from-one-server-to-another