Where does MySQL stored the data in my harddisk?
Here i provide a simple user guide to find out where does MySQL database stored the data in our hard disk, both in Windows and Linux.
Windows
1) Locate the my.ini, which store in the MySQL installation folder.
For Example,
C:\Program Files\MySQL\MySQL Server 5.1\my.ini
2) Open the “my.ini” with our favor text editor.
#Path to installation directory. All paths are usually resolved relative to this. basedir="C:/Program Files/MySQL/MySQL Server 5.1/" #Path to the database root datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"
Find the “datadir”, this is the where does MySQL stored the data in Windows.
Linux
1) Locate the my.cnf with the find / -name my.cnf command.
yongmo@myserver:~$ find / -name my.cnf find: /home/lost+found: Permission denied find: /lost+found: Permission denied /etc/mysql/my.cnf
2) viewthe my.cnf file cat /etc/mysql/my.cnf
yongmo@myserver:~$ cat /etc/mysql/my.cnf # # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english skip-external-locking
3) Find the “datadir”, this is where does MySQL stored the data in Linux system.
However, some storage engine can specify its own data file . i.e,innodb-data-file-path.
By default,the table definitins and data are all located in datadir .
Thanks, but the files do not seem to grow as I add more data to the tables – So is the data really there or are they just the table definitions?
Thanx in tons !!!!!!!!
I was searching the whole net for hours to find my database destination!~!
gr88 work
Thanks. really helpful article to view my tables and other data that MySQL stores in my hard-disk.
[...] Locate the MySQL stored data. Please access this article to find out where does MySQL database saved the [...]