MySQL database import and export operation on Linux system

Source: Internet
Author: User

Demand:
Back up the DZ database in the MySQL database directory to/home/dz_bak.sql, then create a new database Dzbak, and finally import the/home/dz_bak.sql into the database Dzbak.

actions are as follows: The following operations are performed at the terminal command line  


1.mysqldump-u root-p dz >/home/dz_bak.sql #导出数据库
123456 #输入数据库密码
    Extensions:
mysqldump-u root-p dz pre_portal_comment >/home/pre_portal_comment_bak.sql #导出数据库中的某个表
     
2.mysql-uroot-p #进入MySQL数据库控制台
123456 #输入数据库密码
show databases; #查看数据库
CREATE DATABASE Dzbak; #创建新数据库dzbak
Use Dzbak #进入dzbak数据库目录
Source/home/dz_bak.sql importing Dz_bak.sql into the database Dzbak


At this point, the MySQL database Export import operation is completed under the Linux system, similar to the operation under Windows system, please test them yourself.

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.