Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does MySQL store database files on Windows and what are the names of the files?

I accidentally formatted my hard drive and re-installed Windows and forgot to backup an important database I had in my MySQL server. I'm trying to salvage files now using some software, but I don't know what to look for.

What is the path that the files are stored in, and what are the files named (what naming convention, or file extension should I look for)?

I believe my server was using MyISAM, but not 100% sure.

like image 708
Brad Avatar asked Oct 18 '12 05:10

Brad


People also ask

Where are the MySQL database files stored in Windows?

The default data directory location is C:\Program Files\MySQL\MySQL Server 8.0\data , or C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The C:\ProgramData directory is hidden by default.

Where does MySQL store database files?

Typically, MySQL will store data in the default directory of /var/lib/mysql.

Where are DB files stored?

db file might be located at either of these locations: C:\Users\[username]\AppData\Local\Packages\Microsoft. SkypeApp_kzf8qxf38zg5c\LocalState\\main. db.

Where are databases stored in Windows?

The default database file location for server instances depends on the version of the Microsoft SQL Server software: SQL Server 2014 — C:\Program Files\Microsoft SQL Server\MSSQL12. MSSQLSERVER\MSSQL\DATA\ SQL Server 2016 — C:\Program Files\Microsoft SQL Server\MSSQL13.


2 Answers

You can check my.ini file to see where the data folder is located.

Usually there is a folder {mysqlDirectory}/data

MySQL data storage:

Commands.frm Commands.myd Commands.myi 

The *.frm files contain the table definitions. Your *.myi files are MyISAM index files. Your *.myd files contain the table data.

Edit/Update. Because of the interest shown in the question here is more info which is found also in the comments.

In Windows 8.1, the MySQL databases are stored (by default) here: C:\ProgramData\MySQL\MySQL Server 5.6\data

The folder C:\ProgramData is a hidden folder, so you must type it into Windows Explorer address to get there. In that data folder, the databases are named /{database_name_folder}/{database_tables_and_files}.

For instance,

C:\ProgramData\MySQL\MySQL Server 5.6\data\mydatabase\mytable.frm C:\ProgramData\MySQL\MySQL Server 5.6\data\mydatabase\mytable.ibd  

Thank @marty-mcgee for this content

like image 177
Udan Avatar answered Oct 17 '22 05:10

Udan


In Windows 7, the MySQL database is stored at

C:\ProgramData\MySQL\MySQL Server 5.6\data

Note: this is a hidden folder. And my example is for MySQL Server version 5.6; change the folder name based on your version if different.

It comes in handy to know this location because sometimes the MySQL Workbench fails to drop schemas (or import databases). This is mostly due to the presence of files in the db folders that for some reason could not be removed in an earlier process by the Workbench. Remove the files using Windows Explorer and try again (dropping, importing), your problem should be solved.

like image 44
Julio Avatar answered Oct 17 '22 04:10

Julio