Devnote

Web Development Blog Company, Services India

MySQL Error 121 Duplicate key on write - Practical Repair Strategy
MySQL Error 121 Duplicate key on write – Practical Repair Strategy
February 13, 2026
PHP cURL error 60: SSL certificate problem - Windows & Linux Fix
PHP cURL error 60: SSL certificate problem – Windows & Linux Fix
February 11, 2026
Fix localhost refused to connect After Installing XAMPP / WAMP
Fix “localhost refused to connect” After Installing XAMPP / WAMP
February 9, 2026
Composer Error Memory exhausted When Installing Packages - Real Fix
Composer Error: Memory exhausted When Installing Packages – Real Fix
February 6, 2026
MySQL 8 Error Unknown collation: utf8mb4_0900_ai_ci - Safe Migration Guide
MySQL 8 Error Unknown collation: utf8mb4_0900_ai_ci – Safe Migration Guide
February 4, 2026
Devnote

Type and hit Enter to search

  • Home
  • Laravel
    • Auth
    • Migration
    • DATATABLE
    • Yajra
  • wordpress
    • plugin
    • WPBakery
    • woocommerce
  • PHP
    • MYSQL
    • Ajax
  • Blog
  • Informational
    • About us
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
  • Contact US
Devnote
  • Home
  • Laravel
    • Auth
    • Migration
    • DATATABLE
    • Yajra
  • wordpress
    • plugin
    • WPBakery
    • woocommerce
  • PHP
    • MYSQL
    • Ajax
  • Blog
  • Informational
    • About us
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
  • Contact US
Import-export Mysql database using command line

Import-export Mysql database using command line?

Image
Devnote team
October 29, 2020
2
776 Views
0 Comments

This article Is How to import and export the MySQL database using the command line and SQL database backup file to your database server. This is useful for making personal backups of your site, and for importing backups from other servers.

Import

  1. Use FTP to upload your SQL file to your server. or you can use SCP to upload your file via SSH.
  2. Log into your server via SSH.

If you uploaded the backup into your public database_backup directory, go here:

cd /var/www/devnote.in/public_html/database_backup

Import the database by executing the following command:

$ mysql -u [username] -p database_name < db_backup.sql

Execute this command, you will be prompted for your database password. Type it in and hit enter. It may take a few minutes if you have a large database. When the database import is done, you will be returned to the command prompt.

If you get an error that looks like this:

Error: 1045: Access denied for user 'admin@devnote.in' (using password: YES). You entered password is incorrect. Please retype the password, or reset your password in the AccountCenter.

Export

1. Log into your server via SSH.

cd /var/www/devnote.in/public_html/database_backup

2. Export the database by executing the following command:

Specific Database:

$ mysqldump -u [username] -p database_name > db_backup.sql

All Databases:

$ mysqldump -u [username] -p --all-databases > all_db_backup.sql

Specific tables within a Database:

$ mysqldump -u [username] -p database_name table1 table2 > table_backup.sql

Execute this command, you will be prompted for your database password. Type it in and hit enter. Your database will now start exporting. When it is done, you will see the command prompt again. if you have a large database It may take a few minutes.

Categories:

databaseMYSQL

Other Articles

get the current time in python
Previous

How to get the current time in python

create a laravel signature pad
Next

How to create a Laravel signature pad

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

MySQL Error 121 Duplicate key on write - Practical Repair Strategy

MySQL Error 121 Duplicate key on write – Practical Repair Strategy

February 13, 2026
MySQL 8 Error Unknown collation: utf8mb4_0900_ai_ci - Safe Migration Guide

MySQL 8 Error Unknown collation: utf8mb4_0900_ai_ci – Safe Migration Guide

February 4, 2026
How to Fix MySQL ERROR 1698 (28000): Access denied for user 'root'@'localhost'

How to Fix MySQL ERROR 1698 (28000): Access denied for user ‘root’@’localhost’

January 26, 2026
How to Fix SQLSTATE[HY000] [1045] Access denied for user in Laravel and phpMyAdmin

How to Fix SQLSTATE[HY000] [1045] Access denied for user in Laravel and phpMyAdmin

January 7, 2026
Devnote

Devnote provides a collection of tutorials about PHP, Laravel, WordPress, Django, MySQL, Bootstrap, Jquery, Ajax, APIs, CRUD operations, etc.

Devnote © , All Rights Reserved.

Page Links

  • Home
  • About us
  • Blog
  • Contact US
  • Site map

Category

  • PHP
  • Laravel
  • wordpress
  • HTML
  • jQuery

Follow Us

Facebook Instagram Twitter Youtube Linkedin Pinterest
Morbi, Gujarat, India - 363641
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT
Advertisement