43

I have a MySQL database and I want to know the exact location where this data actually stored in the XAMPP folder, I went to this file location to try to get the information:

xampp -> mysql -> data ->

Here I found a separate folder for each of my databases and within these folders I saw files stored with the .frm format (FRM FILE).

When I copied my desired database with all tables in .frm format and try to use them on another PC, I was given an empty database of the same name.

Where are the data files for the database kept on the local server?

Bugs
  • 4,491
  • 9
  • 32
  • 41
Arif
  • 1,222
  • 6
  • 29
  • 60

10 Answers10

45

For Mac, your database files are located at:

/Applications/XAMPP/xamppfiles/var/mysql

You might need admin permissions to access or delete your files.

Alfonse
  • 732
  • 1
  • 6
  • 7
38

Your database is in this directory:
C:\xampp\mysql\data

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Shaktisinh Jadeja
  • 1,427
  • 1
  • 17
  • 22
18

Rather late I know, but you can use SELECT @@datadir to get the information.

Happy file huntin' SO community :)

This is how it looks when ran in phpmyadmin: enter image description here

Can O' Spam
  • 2,718
  • 4
  • 19
  • 45
13

I think the matter is your tables engine. I guess you are using InnoDB for your table. So you can not copy files easily to make a copy.
Take a look at these links:
http://dev.mysql.com/doc/refman/5.0/en/innodb-backup.html
http://dev.mysql.com/doc/refman/5.0/en/innodb-migration.html

Also I recommend you to use something like phpMyAdmin for creating your backup file and then restore the backup file on the next machine using the same IDE.

Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
  • @muhammad thanks alot for answering, ya m using innodb but i try myisam also. I know phpMyAdmin & i import & export data easily but now i need to know the location for my tables – Arif Mar 11 '12 at 07:16
  • @Arif all tables stores in the path you said in your question (mysql\data). But when your InnoDB tables and databases have other related files that do not store in this directory. You need .idb files too that I could not find them in this path – Mohammad Saberi Mar 11 '12 at 07:25
  • @Muhammad i have all tables saved in "**.frm**" type and in same folder there is 1 additional file "**db.opt**" – Arif Mar 11 '12 at 07:32
  • Look at the first link: http://dev.mysql.com/doc/refman/5.0/en/innodb-backup.html – Mohammad Saberi Mar 11 '12 at 07:49
8

Copy and paste the entire data folder, not just the content.
I use xampp, and the path to the data is xampp/mysql/data.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Silva
  • 81
  • 1
  • 2
6

Data are store in this path. You can search data location, just put the below address in your search location (url address):

C:\xampp\mysql\data

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Vivek Kumar
  • 81
  • 1
  • 5
6

The exact location is stored in "my.ini" which exists under main mysql installation directory. In my.ini file, look for 'datadir'. This parameter points the data folder.

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
4

Just in case you forgot or avoided to copy through PHPMYADMIN export feature..

Procedure: You can manually copy: Procedure For MAC OS, for latest versions of XAMPP

Location : Find the database folders here /Users/XXXXUSER/XAMPP/xamppfiles/var/mysql..

Solution: Copy the entire folder with database names into your new xampp in similar folder.

Dharman
  • 30,962
  • 25
  • 85
  • 135
NadZ
  • 1,024
  • 9
  • 10
2

If you are like me, and manually installed your webserver without using Xampp or some other installer,

Your data is probably stored at C:\ProgramData\MySQL\MySQL Server 5.6\data

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Pequenaweb
  • 21
  • 2
2

In Ubuntu the file path is ./opt/lampp/var/mysql

Shardul Birje
  • 341
  • 5
  • 14