Forums / Installing on a Windows Server / Moving mysqldata files physically

Moving mysqldata files physically

Locked

Started by torvista on 14 Nov 2009, 2:36 PM · Views: 9,629

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
14 Nov 2009, 2:36 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,879
Plugin Contributions:
7

Moving mysqldata files physically

Hi,
I'm just moving my development shop from one xampp installation to another, although its only the database that has to move.

Is there any reason why one can't just copy the zen folder from
mysql\data
to the new mysql\data folder or is it safer to import/export everything as usual with phpMyadmin?

I have copied it and it seems ok.

thanks
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

14 Nov 2009, 5:17 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Moving mysqldata files physically

It's always better to export/import if you're uncertain, or if you're working on a live server.

That said, on your TEST server if the software for your MySQL version and its configuration on BOTH computers is IDENTICAL, doing a direct copy will likely not pose any problems.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Nov 2009, 9:52 AM
#3
percepts avatar

percepts

New Zenner

Join Date:
Aug 2004
Posts:
10
Plugin Contributions:
0

Re: Moving mysqldata files physically

there are MySQL catalog tables which hold information about all of your schemas and tables. Look at schema "information_schema" and schema "mysql". These both contain tables with information about other scemas, tables and priviledges.

So if you just copy data folder for one particular schema, the mysql catalogue tables will not reflect the true state of your mysql installation.

I.E. DON'T just copy folder to new installation. Export schema and all tables and then import into new setup or you may experience problems when or if trying to do administration on your zencart tables.

15 Nov 2009, 10:23 AM
#4
percepts avatar

percepts

New Zenner

Join Date:
Aug 2004
Posts:
10
Plugin Contributions:
0

Re: Moving mysqldata files physically

You can copy all folders under the mysql data folder including the mysql folder. I.E. All folders or nothing.

15 Nov 2009, 11:47 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Moving mysqldata files physically

But, keep in mind that if you copy all the MySql catalog tables such as "information_schema" etc, then you're also effectively wiping out whatever was in those tables on the new server.
So, if the privileges are important, either copy everything, making a complete mirror and losing everything from the new server, or manually recreate the privilege details on the new one.

Best is just to export/import IMO. Gives you most control that way.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Nov 2009, 11:56 PM
#6
percepts avatar

percepts

New Zenner

Join Date:
Aug 2004
Posts:
10
Plugin Contributions:
0

Re: Moving mysqldata files physically

DrByte:

Best is just to export/import IMO. Gives you most control that way.

I agree. Also doing export / import will rebuild all indexes so effectively it will do a partial optimisation as well, which, if it hasn't been done for a while, can be a good thing for efficiency/performance.