Published by: admin, date of publication: December 11, 2020

In this post I will take a note to myself and possibly others. Sometimes you have to import or export large databases. But doing it through third-party programs or scripts, it comes down to the limitations of POST data, the size of uploaded files to the server, or, ultimately, the speed of the Internet. Here I will describe the way to import / export Mysql database via ssh (console, terminal).

Database import.

In principle, you can use the command:

mysql -uroot -proot_pass db_name <db_name.sql

but it contains pitfalls in the form of the fact that if, for example, the database has already been created, then the import may fail.

The best way out of the situation is to import directly via the MySQL cli:

We go into MySQL:

mysql -uLogin -pPassword

(instead of Login and Password, enter data for authorizing the database user)
Select the database:

use db_name

(instead of db_name, enter the name of the database)
We import the file into the selected database :

source db_name.sql

(instead of db_name.sql, enter the name of the database dump file or the path to the file if you find it in the wrong folder where the file is located)

Database export.

We export using the convenient mysqldump:


Other materials from our site:

  • Setting up a connection to a Wi-Fi network in Windows 7

    Let's set up a wireless connection for the currently most popular Windows 7 operating system. For this, the system must have drivers installed on the Wi-Fi network card. In addition, in laptops, it is disabled by default, so you should look for a button to enable it. For ASUS, you can try pressing the FN + F2 key combination. For some models, a special button with a drawn antenna is used next to which Wireless may be written. Well, the Wi-Fi access point, I hope you have it configured correctly.

  • Operating system update CentOS Linux 7.7

    In order for the system to be as safe as possible, it must be regularly updated. Software cannot be perfect and new security problems, vulnerabilities and ways of circumventing defenses are constantly found in it. Developers are quick to release fixes for their systems. But for these fixes to apply, you need to upgrade.

  • Latest browsers for Windows XP 32-bit

    Today, let's take a look at the past and plunge into the days of Windows XP. The old woman delighted us from 2001 to April 2019, when the  last of her versions were  no longer  updated . But even earlier, most programs for Windows XP stopped updating.

  • HDD diagnostics in-house with HD Tune

    I would like to tell you a little about HDD diagnostics on my own, I will clearly try to outline typical types of malfunctions in the material, and tell you when to try to do something yourself, and when you cannot do without the help of a specialist. This article is aimed at a target audience with no experience in either repair or data recovery ... We will not touch on highly intelligent concepts and the physics of the problem.  

  • Welcome to WordPress 5.5.3

    With WordPress 5.5.3, your site gets much better in three areas: speed, search, and security.

Leave a Reply

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