Reputation: 1466
I'm just curious as I am beginning to learn PHP and MySQL, as to where the database and other files of MySQL reside on the hard drive. I have installed WAMP on a Windows XP SP2 platform.
Upvotes: 21
Views: 44966
Reputation: 129
Use the following to find the data directory using SQL console:
show variables like 'datadir'
Upvotes: 2
Reputation: 2131
If your on linux you can use:
sudo find / mysql | grep mysql
On Ubuntu it stores its database files in /var/lib/mysql
Upvotes: 1
Reputation: 151
Explore variables from the output of following command:
mysql> show variables like '%dir%'
;
Upvotes: 14
Reputation: 45726
Data directories for mysql
database :
Windows wamp setup
: mysql/data
Linux (Ubuntu) : /var/lib/mysql
my.cnf
configures it as datadir
]Linux :
$ cat /etc/mysql/my.cnf | grep 'datadir'
Windows :
Open mysql/my.cnf (search for `datadir` )
mysql
prompt : ( mysql>
) [ PREFERRED WAY ] mysql> show variable like 'datadir';
I suppose that covers pretty much all cases.
Upvotes: 13
Reputation: 711
I am not sure about WAMP, but if you install MySQL manually it should reside somewhere along the lines of this path:
C:\Program Files\MySQL\MySQL Server 5.1
Upvotes: 2
Reputation: 449803
Usually in the /mysql/data
directory of your WAMP installation. You'll recognize the location because every database has a folder with the same name there.
You can change the location of the data directory using the datadir
setting in my.cnf
. It is often moved elsewhere to ensure the data there gets backed up regularly.
Upvotes: 9