Low Orbit Flux Logo 2 D

Where are MySQL Databases Stored

If you are reading this then you are probably wondering where MySQL databases are stored. It is usually stored in a pretty standard location on disk. You can configure exactly where you want it to be stored which is not a bad idea if you want your data to be kept on a separate disk.

On Linux, MySQL databases are usually stored in this directory:

/var/lib/mysql

They could potentially be stored in other directories as well. You can find out for sure which directory is being used for data by checking in the config file like this ( assuming this is where your config file is located ):

grep datadir /etc/mysql/my.cnf

You should see a line like this showing you the path to the data dir:

datadir = /var/lib/mysql

On Windows you can check your config file ( my.ini ). It may be in a location like this:

C:\Program Files\MySQL\MySQL Server 5.1\my.ini

You should be able to find a line where it defines the data dir:

datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"

Note that this is the actual files or subdirectories that hold the database may be different depending on which storage engine you are using.