Dumping data from a MySQL database of a remote Linux Service

Source: Internet
Author: User
Tags ssh secure file transfer ssh secure shell

After receiving a new task today, You need to import MySQL database data to the local machine from the remote server. This is really a bit of a duck on the shelf. Because I have almost never touched mysql before, and MySQL is deployed on a Linux server, what's more, the MySQL database server cannot be accessed directly through a public IP address, you must first log on to a Linux server and operate on another Linux server as the pedal.

Now that the task has arrived, you cannot do it. I searched the internet and finally got an eye on it. The procedure is as follows:

1. log on to the remote Linux Server

The remote server can use the SSH protocol to log on and start to use PUTTY. However, after the connection, the password cannot be pasted. The server password cannot be at least 20 characters long and contains all characters. It is obviously too tired to lose each character, later I asked my colleagues who are familiar with Linux and recommended that I use SSH Secure Shell Client. Easy to use.

2. log on to the mysql database server from a remote server.

The Remote Server is a Linux system. to log on to another Linux system, you must use ssh.

# Ssh [mysql Server IP address]

The password will be entered later, because it is operated in the SSH Secure Shell Client, you can directly paste the password.

3. dump the mysql database

Because you do not know the mysql database name, log on with the mysql Command first, and view the database in show databases.

Mysqldump-u user name-p Password Database Name> dump file path and name

4. Copy the dump file from the mysql server to the remote server.

Scp [mysql Server IP address]: dump file.

Because both the remote server and the mysql server use root to log on, after executing the command, you must enter the root password of the mysql server. After the password is entered, the dump file will be copied to the root's home edge.

5. compress the dump file

Dump has more than 1 GB of files and tries to download them directly. The fastest speed is more than 100 kb. It takes several hours to download the files. Compress it first.

Bzip2-zv dump file

It took less than 5 minutes to compress and compressed more than 100 MB, saving time for downloading. The file bz2 is compressed, and the uncompressed file is missing. Www.britepic.org bzip2 has a-k option to retain files before compression.

6. Copy files from the remote server to the local device

This step is simple. The SSH Secure Shell Client software provides an "SSH Secure File Transfer Client" with a similar layout as cuteftp.

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.