Mysql locally imports data from a remote database bitsCN.com
Mysql locally exports data from a remote database
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
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 ]......
BitsCN.com