How to export data from a remote database in a mysql local database

Source: Internet
Author: User

Preface: I recently started to use the Ubuntu system. There is really no good mysql interface program, so I can only operate it on a terminal.
Procedure: open terminal, enter the following content, and press Enter.
That's all!
Purpose: copy the database of the remote server to a local device.
Java code
Copy codeThe Code is as follows:
Mysqldump-h '2017. 212.111.123 '-uROSE-pxxxooo -- opt -- compress ITSM -- skip-lock-tables | mysql-h localhost-uroot-proot ITSMC

* ********************* Gejige 1: if you do not know the truth, see the following *******************************
Explanation:
114.212.111.123 remote server name
ROSE remote database Login Name
Xxxooo remote database logon Password
ITSM remote database name (that is, the source of the copy)
Localhost local database name (usually this is the name)
Root local database Login Name (this is usually the case)
Root local database logon password (this is usually the case)
ITSMC local (that is, the purpose of replication)
SQL explanation:
Mysqldump is a mysql Command Used for copy operations.
-- Meaning of opt operation
-- Compress: compresses the data to be transmitted
-- Skip-lock: Ignore the locked table (this clause can prevent an error when the table has a foreign key)
-Tables: all tables in a database
-H server name
-U User Name (* without spaces, add the user name directly)
-P password (* the password is directly added without spaces)
Note:
-U and-p are not followed by spaces. directly add the user name and password !!!
: None of your business ************************
This morning, the music of a song [not seeing you for a long time ]......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.