Select Page

If you’re a developer who likes to use the Windows platform when building software, you’ll no doubt be using MySQL at some point along the way and an IDE such as Eclipse, NetBeans or something else. For the more basic activities you’ll be doing within your application when interacting with your MySQL database, there will be nothing much to worry about. Whereas with other work you’ll be doing, it is essential to take a backup of your MySQL database with ease, to make sure that you don’t lose all of your test data in the database when you make a mistake in one of your SQL commands.

When you installed MySQL in the first place, you’ll likely have installed this somewhere such as;

 

C:\Program Files\MySQL\MySQL Server x.x

 

So open command prompt and navigate to the folder that your MySQL version is installed in, then inside the bin folder;

 

CD C:\Program Files\MySQL\MySQL Server x.x\bin

 

Next you need to run the following command. Make sure you personalise the details according to the database you created in the first instance;

 

Mysqldump –u yourusername –p databasename > C:\Users\YourUsername\databasebackup.sql

 

Note, if you try to save the file to C:\ for example, then this will result in an access denied error message. The reason for this is because you need Administrator privileges to do this, just like when you’re installing a new piece of software. So instead, make sure you save the file within your current user account that you are logged into Windows with.

Then if you ever need to restore the database, run the following command;

 

mysql -u yourusername -p databasename < C:\Users\YourUsername\databasebackup.sql

 

Simples. Yet often can be a little more challenging in practice depending on the details you have configured. Hope this is a useful starting point for when you need to do this.

The following two tabs change content below.

Michael Cropper

Founder & Managing Director at Contrado Digital Ltd
Michael has been running Contrado Digital for over 10 years and has over 15 years experience working across the full range of disciplines including IT, Tech, Software Development, Digital Marketing, Analytics, SaaS, Startups, Organisational and Systems Thinking, DevOps, Project Management, Multi-Cloud, Digital and Technology Innovation and always with a business and commercial focus. He has a wealth of experience working with national and multi-national brands in a wide range of industries, across a wide range of specialisms, helping them achieve awesome results. Digital transformation, performance and collaboration are at the heart of everything Michael does.