Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I know this question may be similar to some others posted but think it may be slightly different, so hopefully it's ok.

Basically I just reinstalled Windows as I bought a new HD and I am in the process of copying all the MySQL databases back to the new installation dir; however I'm not sure if it's ok to copy all the default MySQL databases back with it? Those being:

  • cdcol
  • mysql
  • performance_schema
  • phpmyadmin
  • test
  • webauth

I assume one of these contain details I want to keep such as info about the users and also other stuff like mysql variables - unless that is found in a MySQL .ini file or something?

I'm not 100% sure but I'm pretty sure I'm still using the same version of MySQL. If it matters I am using XAMPP.

So basically my question is can I copy the old folders above over the new ones and what are these folders/databases used for exactly (other than the obvious phpmyadmin one)?

share|improve this question
    
What version of MySQL did you install, and were you using MyISAM or InnoDB for your tables? –  Michael - sqlbot Aug 11 '13 at 0:15

1 Answer 1

up vote 1 down vote accepted

Let's say on the new server you want datadir to be D:\MySQLData

Simply copy everything and all subfolders from old server's C:\Program Files\MySQL\MySQL Server 5.5\data to the new server's D:\MySQLData. You said you are using XAMPP. RUn this query SHOW VARIABLES LIKE 'datadir';. Copy that folder to D:\MySQLData.

Then add this

[mysqld]
datadir="D:/MySQLData"

in the new server's my.ini

This will work seamlessly if the new server has the same version of MySQL as the old.

If the new server has the next higher major release (5.1 -> 5.5,5.5 - > 5.6) you will then have to run mysql_upgrade --upgrade-system-tables. Make sure you keep a backup.

If you are using InnoDB (in whole or in part), get all the InnoDB settings from the old my.ini over the new server's my.ini.

Give it a Try !!!

share|improve this answer
    
Caveat, stop the MySQL server before moving files around. –  Michael - sqlbot Aug 11 '13 at 5:57
    
Thanks - everything seems to be working correctly! –  Brett Aug 11 '13 at 8:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.