backup database C:\xampp\mysql\data ?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

backup database C:\xampp\mysql\data ?

Postby bert2008 » 18. December 2008 21:09

Hello,

It's the first time I'm using Xampp.

I have a question about making a backup of a mysql database (+300 MB). Is it only possible in PHPMyAdmin, or can you just copy the database folder in C:\xampp\mysql\data ?

gr.
bert2008
 
Posts: 2
Joined: 18. December 2008 21:03

Re: backup database C:\xampp\mysql\data ?

Postby Sharley » 18. December 2008 22:30

In phpMyAdmin you would use the export database facility usually, but always, to backup or copy/export a database to another location that has another instance of MySQL, for example a hosting service from your local development server and visa versa - by creating an sql file of your tables and data.

On your local server you only need to make a copy of the database name folder (complete) to another location so that on regular intervals, after the database has fresh data for example, you only need to copy the folder over the original copy by overwriting the complete named database folder.

For example, you have a database named wordpress and in the C:\xampp\mysql\data folder you have a folder named wordpress then you just copy and paste the folder to say C:\xampp\mysql\data\backup. Then at regular intervals just repeat the copy and paste to keep the backup updated with the fresh data.

Always test this process so you know in your own mind that it works for you.
Good luck.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: backup database C:\xampp\mysql\data ?

Postby bert2008 » 18. December 2008 22:54

Thank you! it sounds perfect as I'm using the database only on my localhost. I will test this out on an old DB.

gr.
bert2008
 
Posts: 2
Joined: 18. December 2008 21:03

Re: backup database C:\xampp\mysql\data ?

Postby wille » 21. December 2008 03:35

Did anyone test this for a clean install? I think (I'm not sure) when you have a database there is more data linked with that folder, like maybe settings.
wille
 
Posts: 3
Joined: 21. December 2008 03:32

Re: backup database C:\xampp\mysql\data ?

Postby Sharley » 21. December 2008 04:39

wille wrote:Did anyone test this for a clean install? I think (I'm not sure) when you have a database there is more data linked with that folder, like maybe settings.
What "settings" do you have in mind?


I have tested it and it works for me or I would not have suggested it here - I have even copied over a database name folder to another test instance of XAMPP I have on another drive, which also was faultless (the path tree is the same in both instances except the actual xampp folder name which is taken care of in the mysql\bin\my.cnf file).

As I mentioned above you may test it yourself and then, if you wish, post back here your findings so you can then "be sure" about your perceived concerns which may help others with perhaps similar concerns.

This method allows you to backup the whole mysql\data folder by making a copy to a location out of the xampp folder tree.

It is even possible to move the whole mysql\data folder to another location on your PC as long as you tell MySQL where you have moved it to by editing the mysql\bin\my.cnf, file under this section:
my.cnf wrote:# The MySQL server
[mysqld]
basedir="C:/xampp/mysql"
tmpdir="C:/xampp/tmp"
datadir="C:/xampp/mysql/data"

No other "settings" to change are listed in this configuration file to further ease your concerns about backing up your databases but, as I also mentioned above, you can export a backup copy of your database to an sql file using PMA if you prefer.

BTW the mysql\bin\my.cnf file may appear simply as a my shortcut file which to read and or edit should be dragged into your text editor.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: backup database C:\xampp\mysql\data ?

Postby wille » 21. December 2008 04:59

I do believe you if you say you have tested this out with a new installation. I was just making sure you were not talking about the same one. Thanks Sharley for explaining this (again). BR
wille
 
Posts: 3
Joined: 21. December 2008 03:32

Re: backup database C:\xampp\mysql\data ?

Postby elgati » 29. October 2010 20:46

Does anyone know how to do this between Mac and Win?
I have a WordPress database on Mac and I want to test it on Win without having to do all the reposting etc.

Thanks in advance.
elgati
 
Posts: 1
Joined: 29. October 2010 20:03

Re: backup database C:\xampp\mysql\data ?

Postby JonB » 30. October 2010 03:44

The same MySQL command line arguments 'should' work. mysqldump is cross platform

http://support.apple.com/kb/TA24993

You can also use the WordPress Plugin I use: (EASY)
http://austinmatzko.com/wordpress-plugins/wp-db-backup/

Either way, the output will be a .sql or .sql.gz file that is OS neutral. I do this on Centos Linux to Windows and back regularly, so it should work OK on Macs also.

You can then import the file into your XAMPP install with either mysqlimport, the MySQL Monitor or phpMyAdmin

http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html

Be sure to create the user, database and GRANT and FLUSH privileges before you try to import.

Good Luck
:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 119 guests