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.
Hello, I’m using MySQL 5 on Windows 7 and my database was stored here : C:\ProgramData\MySQL\MySQL Server 5.5\data
Hello,
I found the post usefull, but the information I am searching is how can I alocate diferents databases in diferents path? with the same mysql instance?
thanks
I am not a computer tech, but using MacBook pro, Safari, opening a website I get the following error: Replace Query: 1114: The table ‘swsessions’ is full in ./__swift/library/Database/class.SWIFT_Database.php:1110. Any help as to how to fix the problem appreciated. I recently did a maintenance clean up on my computer and may have deleted something in error.
where i can see the query executed from JPA in MySQL, How to log the queries to FILE
Hi
Can you explain why mySQL Administrator reports a db index & data of 22MB but the “datadir” is only a series of files of 10KB and the are all *frm files
On my file it says:
# These are commonly set, remove the # and set as required.
# basedir = …..
# datadir = …..
# port = …..
# server_id = …..
Do you know where is it commonly set to be?
BTW, I am using the community edition. Thanks
On Linux:
find / -name my.cnf 2>/dev/null | xargs cat | grep ‘datadir’
find / -name my.cnf 2>/dev/null | xargs grep ‘datadir’
Thanx alot. this article really helped me…
Yes I found mine,
Does it work if we copy the database folder and use it in different system??
Please let me know, where I can find in mac system
On Linux, perhaps, the following can help (I mean, if the server is already running)
–datadir=/var/lib/mysql
Is mysql server stored all data in flat file structure ?, please share it.
Hi this is rajeshkannan i am new to java with mysql.
i am using a server which has database name: redmine_wrk
There is a table name attachments in that database.Which has encrypted file path column.
I dont know the key for that but i know the path from which i need to download the file.
But i don’t know how to download file its in path: /var/www/html/redmine/files
its very urgent can any one please help me .
Thanks in advance
hey this is is of no use I think. Since then I copied the database from the location which you have intimidated and pasted it on another computer which has same mysql location. The positive side is that it shows the database and the tables in query browser but when I open the table it shows “got error 1 from storage engine error no 1030”
For Windows 7, it actually stored the ini into:
C:\ProgramData\MySQL
and not into
C:\Program Files\MySQL
Thankyou – just saved me a massive headache recovering data from an old hard-drive – could not figure out where my MySQL data files had gone and there they are.
thanks man !!! u r a life saver !!
hey,
i made a php script to copy data from mysql to notepad in csv format.
where does it store in my computer.
also i didn’t find C:\ProgramData\MySQL path in my C drive.
It really helped. Thanks a lot!
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 .
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.
You save me man!.
Kudos! Thank you!
In your HARD disk?
Thanks for the help!
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?