Author: Edit Olah

How to export MySQL database into a ‘.sql’ file on WAMP

MySQL dump in Windows command prompt

If you are used to Linux/Unix based environments using the command line on Windows could get a bit tricky. Here are some steps as a reminder of using mysqldump on WAMP.

Accessing MySQL shell in WAMP

System details

In this article we are working with WAMP 3 - WAMPSERVER (64 BITS & PHP 5.6 & PHP 7) 3.

As of 01.08.2016, the package includes:

64 bit WampServer 3.0.4:

  • Apache 2.4.18
  • PHP 5.6.19/7.0.4
  • MySQL 5.7.11

Operating system: Windows 10

System type: 64-bit

Logging in to MySQL from the Windows Command Prompt

To access mysqldump program change directory to the WAMP server’s binary folder:

cd wamp64\bin\mysql\mysql5.7.11\bin

Then log in:

mysql.exe -u root

You might be asked for a password as the next step.

From WAMP's UI

Open WAMP’s pop up navigation by left clicking on the WAMP icon in your system tray and navigate to MySQL > MySQL console

Using mysqldump on WAMP

To access mysqldump program, change directory to the WAMP server’s binary folder:

cd wamp64\bin\mysql\mysql5.7.11\bin

To use the mysqldump program:

mysqldump -u mysqlusername -p databasename > c:\wamp64\www\siterootfoldername\databasedumpfilename.sql
	Enter password:

Example:

mysqldump -u root -p my_database > c:\wamp64\www\projectrootdirectory\dbdump_date.sql

- ! TIP ! -

To get back to the root directory on Windows:

cd\ // (same as cd ~ in Unix/Linux)

Resources:

How to dump MySQL database on WAMP: https://snippetsofcode.wordpress.com/2011/08/02/howto-dump-mysql-database-on-wamp/

Related blog posts

  • Setting up multiple projects in WAMP 3 with aliases

    Setting up multiple projects in WAMP 3 with aliases

    Local development environment

    When you have to set up a development environment quickly on a Windows...

    More details >>

  • My often used MySQL commands

    My often used MySQL commands

    Basic MySQL commands

    Basic commands for managing databases in MySQL on the command-line in local...

    More details >>

  • ‘mysqldump Version Mismatch’ warning from MySQL Workbench

    ‘mysqldump Version Mismatch’ warning from MySQL Workbench

    Changing the path to mysqldump program file

    How to make sure that the mysqldump.exe version of MySQL Workbench is equal...

    More details >>

Contact Edit

Get in touch

If you are interested in hiring me, please drop me an email. I would be happy to send you my up-to-date resume.

Drupal Association member
Image of Edit