How do mysql local databases derive data from remote databases

  • 2020-05-14 05:04:35
  • OfStack

Write in front: recently started to use Ubuntu system, really no good mysql interface program, so... You have to use the terminal.
Operation process: open [terminal], directly enter the following content, click enter
That's all!
Purpose: copy the remote server's database locally.
Java code
 
mysqldump -h '114.212.111.123' -uROSE -pxxxooo --opt --compress ITSM --skip-lock-tables | mysql -h localhost -uroot -proot ITSMC 

* * * * * * * * * * * * * * * * * * * *, ji, ji 1: unknown truth see below * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Explanation:
114.212.111.123 remote server name
ROSE remote database login name
xxxooo remote database login password
ITSM remote database name (i.e. : source of replication)
localhost local database name (1 in general)
root local database login name (1 normally)
root local database login password (1 normally)
ITSMC local (i.e. for the purpose of replication)
sql explanation:
mysqldump is one of mysql's commands for copying operations
--opt operation
--compress compresses the data to be transmitted
-- skip-lock ignores locked tables (this prevents errors when a table has a foreign key)
-tables all tables in a database
-h server name
-u user name (* no space after user name)
-p password (* no space after the password)
Note:
-u, -p after no space, directly add user name and password!!
* * * * * * * * * * * * * * * * * * * *, ji, ji 2: none of your business * * * * * * * * * * * * * * * * * * * * * * * *
This morning, I was listening to the melody of a song [long time no see]...

Related articles: