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:

Tags:

Other materials from our site:

  • Welcome to WordPress 5.5.3

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

  • The second wave of 802.11AC is already in USB: testing Edimax EW-7822UTC

    To be honest, I did not even hope to hold a Wi-Fi USB adapter of the 802.11AC Wave-II standard in my hands, but it so happened that one of those looked at my review - this is Edimax EW-7822UTC USB 3.0 802.11AC Wave 2.

  • 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.  

  • 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.

Leave a Reply

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