How does MySQL export databases?

Source: Internet
Author: User
Tags import database

Mysql tutorial how to export a database tutorial

This article has added to my favorites most of the methods for exporting databases from mysql. A friend sent an email yesterday asking me how to export the database from mysql. Below we have summarized some methods for importing the database.
Although not original, it is a summary.

Go to cmd (note that in OS cmd, instead of mysql)
==============================
1. Export the database (SQL script)
Mysqldump-u username-p Database Name> exported file name
Mysqldump-u root-p db_name> test_db. SQL
2. mysql exports a database table
Mysqldump-u user name-p database name Table Name> exported file name
Mysqldump-u wcnc-p test_db users> test_users. SQL (no semicolon at the end)

Experience 2

Dynamic mysql Service
/Etc/init. d/mysql start

Export the entire database
Mysqldump dbname> c: mydb. SQL-u root-p

Import Database
Source mydb. SQL

Mysql-u username-p database name <database name. SQL


Method 3: If you have server Permissions


(1) directly copy database directories and files

Method 4

Php tutorial myadmin Tool

Select "structure" and "data" to export. Do not add the "drop database" and "drop table" options.

Select the "Save As file" option. If you have more data, select the "gzipped" option.

Save the exported SQL file.

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.