View Full Version : Where are my databases!?
09-23-2011, 05:09 PM
Hey, this isn't exactly coding related but server. I basically need to backup a database as I need to restore my PC to factory settings. Apparently my databases should be stored in mysql\data.
This folder for me is here: C:\xampp\mysql\data
Although, for some reason the mysql cmd displays all of my databases, but some which are listed are not in the folder :S They are not hidden either. The "test" database was created using the CMD although the database I need to backup is "minecraft", but that is not shown in the folder...
Any idea where it is?
09-23-2011, 05:27 PM
Instead of just backing up the files you can/should use the mysqldump program that is in the bin folder under MySQL which is designed to backup one or all of the databases on the MySQL server.
But to answer your question as to where the files are, if some of those DBs are using the InnoDB storage engine they the data is all stored in the ib* files you see in that directory. If memory serves just copying those files to a new installation doesn't work, at least not without effort.
09-23-2011, 05:31 PM
I tried opening the mysqldump but it just closes. I have also tried the command that I have seen on some websites and that also doesn't work
09-23-2011, 06:50 PM
It is a command line application so you need to run it from an already open command window.
Start > Run > cmd
09-23-2011, 07:51 PM
Ummm...and you need to direct the output of the dump to a file.
And you need the username and password and databasename.
c:\some\folder> mysqldump -uUSER -pPASSWORD DATABASENAME > databaseName.sql
There are other options available. When in doubt, you know, you can read the manual:
09-24-2011, 04:23 AM
Okay, an error occured.
C:\Users\Martyn Ball>cd \xampp\mysql\bin
C:\xampp\mysql\bin>mysqldump -martynball -password minecraft > minecraft.sql
mysqldump: unknown option '-m'
Is the last option (minecraft.sql) the name of the file which is to be created? Or where it is saved?
09-24-2011, 04:39 AM
You forgot the -u and -p in front of your username and password respectively. minecraft.sql will be the file where the database is backed up to.
You can run mysqldump -h to see all the different arguments you can pass the program.
09-24-2011, 05:01 AM
oooh, didnt realise i needed that :P haha. It has worked now thanks, how do I restore this after and merge it or add it back to mysql?
09-24-2011, 05:13 AM
You'll love this:
C:\xampp\mysql\bin>mysqldump -umartynball -pPassword < minecraft.sql
In other words, you just send the SQL commnands that are in the ".sql" file to MYSQL and presto.
Caution: Don't do this if the database you are trying to restore still exists!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.