Skip to main content

How to create WordPress MySQL database backup using command line

WordPress site backup is quite important, if you run into any situation where you only see error like establishing databases connection for WordPress site or your site breaks, then the first thing that usually comes in mind is Backup, here are some home made tips for you.

Complete WordPress site backup

For complete backup of WordPress site you need to have complete folder of WordPress installation directory that includes wp-content, wp-admin, wp-includes, index.php, wp-settings.php, wp-comments.php, wp-cron,php etc....these all directories, files and subdirectories.

he most important thing is your wp-config.php file that connects your wordPress installation with your MySQL WordPress database. Other then that you the most important thing is your wordpress database, you must have its backup for complete Wordpress restoration. In this post i am sharing my personal experience that explains how to create WordPress MySQL database backup.

Wordpress Database backup Plugins

I have used two wordpress popular plugins that will let you download all your MySQL database tables in a .sql file that can be uploaded to your new site database. First of all you need to install any one of these two mentioned plugin  
  1. WP database backup plugin by Prashant Walke
  2. WP DB-Backup Plugin by Austin Matzko
Both these plugins are used by me and these are great, the first plugin that is by Prashant Walke is fast and creates backup little bit faster than the second one, but sometimes it fails then you need to use WP DB-Backup plugin by Austin Matzko.

How to Create Wordpress Backup using Plugin

Go to add a new plugin search for Wordpress database backup plugin Check for these two plugins, first of all install WP database backup plugin by Prashant Walke, If the first plugin does not work on your site then try second one .

After installation Go to Tools click on WP-DB Backup 
Click on Create database backup button
if database backup is successfully created then you can download it to your local computer in zip file Now extract this file to find your database backup in .sql file 
Similarly you can create backup using WordPress DB Backup plugin by Austin Matzko

If you are using dedicated server and your site is hosted on AWS linux instance you can directly download MySQL database backup by command line For complete database backup of single database via command line in MySQL

$ mysqldump -u { db-username } -p { db-password } db_name > db_backup.sql

Here you need to replace { db-username } with your db-username and { db-password } with your database password  similarly db_name for database name db_backup.sql is file name is backup file name

If you find error in running the first command than run this

$ mysqldump -u { db-username } -p db_name > db_backup.sql 

it will ask for your db-password after entering correct password Wordpress MySQL database backup will be created successfully.

Comments

Popular posts from this blog

Sublime text editor most useful command List Download

Sublime text editor: Sublime text editor is one of the best text editor for windows and Linux . It is a cross source code editor with Python application programming interface (API). It supports number of programming languages and markup languages. I work everyday with Sublime text editor i love it and here are list of shortcuts that you can find useful for your passion of code writing. Select a single Line: Ctrl + L Delete a Line: Ctrl + Shift + K Duplicate a line: Ctrl + Shift + D Find and Replace: Ctrl + F and Ctrl + H Move a Line Up or Down: Ctrl + Alt with up/down arrow Keys Open a new file: Ctrl + N Move along the tabs: Ctrl + Tab and Ctrl + Pageup and Pagedown Comment a Line: Ctrl + ? Divide in 1, 2, 3, 4 Grids: Alt + Shift + 1 and Alt+ Shift + 2, Alt + Shift + 3, Alt + Shift + 4 and Alt + Shift +5 Upper Case : Ctrl + KU Lower Case: Ctrl + KL Exit Sublime: Ctrl + Shift + W Select Line/Lines Shift + up Arrow Key ( press arrow key again to select upper lines) ...

How to back in GUI mode from Ubuntu Linux ttty Text mode

Accidentally I  pressed ctrl + Alt + F1 today in Ubuntu 16.0.4. It switches Ubuntu to text mod tty mode. There are 12 terminal in Linux 6 of them are text and can be switched by pressing  Ctrl + Alt + F1 .. F2 uoto F6. If you are facing same issue you can get back to normal GUI by using Ctrl + Alt + F7 button together. If your computer have Function keys (Fn) you need to press it too. Means you may need to press ctrl+Alt+ Fn + F7