How to export MySQL Database on Windows with mysqldump

German library.

To export a database in Windows we need to run a file called “mysqldump.exe”. This file is located within the “MySQL” folder, which is inside the “Program Files” folder. The full path is shown below:

C:\Program Files\MySQL\MySQL Server 8.0\bin

We need to run this file with the Windows Command Prompt or the PowerShell. So we begin by cd’ing into the correct folder. I got the path by just copying it from the File Explorer:

Screenshot of copying path from file explorer.

And I cd into the folder with the PowerShell:

Screenshot of Windows Powershell.

At this point we will run a command with the format shown below:

.\mysqldump.exe sleep_app -u root -p > "C:\Users\HP EliteBook 8470p\Documents\sleep_app.sql"

Running a command with the above format should be all you need to do! You should be prompted for your MySQL password, and upon typing it in and pressing “Enter”, your database should be created in the specified location. There will be no success message, or any message whatsoever.

I will explain the command below, but first here’s a screenshot of the PowerShell after the executed dump:

Screenshot of Windows PowerShell.

We are running the file mysqldump.exe. We need to identify the name of our database, in my case, “sleep_app”. We then need to add a flag for the username and password of the database. In my case the user is “root”, and this may be the default username for you too. So we add a “-u” flag for the username, and a “-p” flag for the password. We also need to add a “>” and the path name where we want the database to be saved. We also need to add the database name at the end of the destination path. My file name is “sleep_app.sql”. Again the command is shown below:

.\mysqldump.exe sleep_app -u root -p > "C:\Users\HP EliteBook 8470p\Documents\sleep_app.sql"

And when I navigate to my Documents folder I see my database dump waiting for me!

File explorer screenshot.

If this worked for you, then congratulations! You did it, and I’m proud of you. If not, then keep reading other advice and you’ll surely figure it out.

Girl in nature.

Bonus: How to See Where Your Databases are Stored

The actual database is in a hidden folder called “ProgramData” (NOT “Program Files”). You need to change your settings to be able to view the hidden folder if you want to access it in the Explorer. You can do so by navigating to “Options” through the “File” tab in the top left of the File Explorer, and then clicking on the “View” tab and scrolling to “Hidden files and folders”, and selecting “Show hidden files, folders, and drives.” The navigation path I just described looks like so:

File > Options > View > Hidden files and folders > [select “Show hidden files, folders, and drives”]

You can see screenshots of this process below:

Screenshot of Windows file options hidden folders.
Screenshot of Windows file options.