Where does MySQL store database files on Windows and what are these files called?

Therefore, I accidentally formatted my hard drive and reinstalled Windows and forgot to make a backup copy of the important database that I had on the MySQL server. Now I am trying to recover files using some software, but I do not know what to look for.

In what way are the files stored, and what are the names of the files (what naming convention or file extension should I look for)?

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

Any advice would be appreciated!

+62
windows database mysql data-recovery
Oct 18 '12 at 5:25
source share
13 answers

You can check the my.ini file to find out where the data folder is.

Usually there is a folder {mysqlDirectory} / data p>

MySQL Data Warehouse:

 Commands.frm Commands.myd Commands.myi 

* .Frm files contain table definitions. Your * .myi files are MyISAM index files. Your * .myd files contain table data.

Edit / Update . Due to the interest shown in the question, there is more information that appears in the comments.

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

The C: \ ProgramData folder is a hidden folder, so you must enter it in the address of Windows Explorer to get there. In this folder, the database data is called /{database_name_folder}/{database_tables_and_files} .

For example,

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

Thanks @ marty-mcgee for this content

+70
Oct 18 '12 at 5:27
source share

On Windows 7, the MySQL database is stored in

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 is useful to know this location because sometimes MySQL Workbench cannot delete schemas (or import databases). This is mainly due to the presence of files in the db folders, which for some reason could not be deleted in the earlier Workbench process. Delete files using Windows Explorer and try again (delete, import), your problem should be resolved.

Hope this helps :)

+36
Aug 10
source share

I have a default my-default.ini file in the root directory and there is one server configuration:

 [mysqld] sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

So this does not tell me the way.

The best way is to connect to the database and run this query:

 SHOW VARIABLES WHERE Variable_Name LIKE "%dir" ; 

Here is the result:

 basedir C:\Program Files (x86)\MySQL\MySQL Server 5.6\ character_sets_dir C:\Program Files (x86)\MySQL\MySQL Server 5.6\share\charsets\ datadir C:\ProgramData\MySQL\MySQL Server 5.6\Data\ innodb_data_home_dir innodb_log_group_home_dir .\ lc_messages_dir C:\Program Files (x86)\MySQL\MySQL Server 5.6\share\ plugin_dir C:\Program Files (x86)\MySQL\MySQL Server 5.6\lib\plugin\ slave_load_tmpdir C:\Windows\SERVIC~2\NETWOR~1\AppData\Local\Temp tmpdir C:\Windows\SERVIC~2\NETWOR~1\AppData\Local\Temp 

If you want all the parameters configured for the database to do this:

 SHOW VARIABLES; 

The storage_engine variable will tell you if you are using InnoDb or MyISAM.

+11
Feb 12 '15 at 4:05
source share

For Windows 7: c: \ users \ all users \ MySql \ MySql Server xx \ Data \

Where xx is the version number of the SQL server installed on your computer.

Fidel

+6
Feb 02 '14 at 7:40
source share

This should be your {installation path} \ data, for example. C:\apps\wamp\bin\mysql\mysql5.5.8\data\{databasename}

+3
Oct 18 '12 at 5:29
source share

It is usually located in the folder below, but ProgramData is usually a hidden folder. To show this, go to the control panel, find the "folder", then in the advanced settings mark the hidden files and click "Apply." C: / ProgramData / MySQL / MySQL Server 5.5 / Data /

+3
Mar 01 '16 at 8:25
source share

Just search on Windows * .myi on local partitions. Period.

As I suspected, they were inside the program files folder, instead of using the corresponding folder for data only, as most other database managers do.

Why search for my.ini file, open it with an editor, search for the path line, do not change the configuration file (!), And then perform a second search? Difficult, without the use of additional benefits, except for the practice of touch input.

+2
Oct 17 '13 at 15:01
source share

I just installed MySQL 5.7 on Windows7. The database files are located in the following directory, which is hidden: C:\ProgramData\MySQL\MySQL Server 5.7\Data

The my.ini file is in the same root directory: C:\ProgramData\MySQL\MySQL Server 5.7

+2
Feb 19 '17 at 11:12
source share

in MySQL:
".myd" is the database and
".tmd" is a temporary file.
But sometimes I see also ".sql".

It depends on your settings and / or export method.

+1
Sep 07 '15 at 9:44
source share

1) Find my.ini, which is stored in the MySQL installation folder.

For example,

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

2) Open "my.ini" with our 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 

Search for "datadir", this is where MySQL stores data on Windows.

0
Oct 18 '12 at 5:30
source share

C: \ Program Files \ MySQL \ MySQL Workbench 6.3 CE \ sys

Paste the URL into the window file and get Tables, Procedures, Functions from this directory

0
Feb 01 '17 at 15:33
source share

MYSQL 8.0:

Search my.ini on disk, we will find this folder:

C: \ ProgramData \ MySQL \ MySQL Server 8.0
This is ProgramData , not Program file

The data is located in a subfolder: \Data .

Each database folder, each table is a file, each index is 1+ files.

Here is an example sakila database: enter image description here

0
Sep 07 '18 at 14:21
source share

If you use Win10 with the Xampp server installed, you can find the data folder in C: \ xampp \ mysql \ data

Inside the data folder, each database has its own folder, which, in turn, contains the .frm, .myi, and .myd files that represent one table in the database.

If, for example, you created a database with the name: myschool and inside the database, you have three tables with names:

  1. nursery
  2. primary
  3. secondary

Then you will have at the children's table: nursery.frm, nursery.myi and nursery.myd. The same goes for primary and secondary tables. Thus, in the file I mentioned, you will find a total of 9 files in the database folder named myschool .

Then you can copy the database folder and use it in the new mysql installation data folder.

Hope this helps.

Regards.

0
Apr 22 '19 at 13:43 on
source share



All Articles