) About Mysql Data export, import, and version Conversion

Source: Internet
Author: User
Source: http://bbs.mysql.cn/viewthread.php? Tid = 72 & extra = Page % 3d1% 26 filter % 3 ddigest
About Mysql Data export and version Conversion

Recently, many people are asking about MySQL.
The import and export problems, so I simply summarized some of my use experience for your reference, there are unreasonable places to welcome!

I. MySQL DATA Export

 
Some webmasters often use the most direct method of copying database folders. This method is simple, but it is not recommended that it is prone to problems in cross-version or cross-Character Set Systems. Besides, database 4.1 has two data storage methods available during configuration. One is to store the same data inventory as before in a separate folder, another is what I forgot. All these databases are put in one file, a huge file !, So the latter cannot use the copy method. What should I use? The following describes:

 
Mysqldump is the MySQL tool. It is very powerful and can export data, and can export data of different versions or other databases.
This tool is actually used in command line and cmd. If your msyql/bin directory is not configured in the system environment variable, CD to the MySQL/bin directory first.

1,
First, we will introduce how to export: mysqldump-u database username-P database name [Table name]> path name of the exported file.

Example: I want to export
Test_db: My database user is root and has no password (-P is not required if there is no password ):
Mysqldump-u
Root test_db> C: \ test. SQL so that you can test the database everywhere.
If you want to export Test
The User table in the database uses ajin. The password is 123.
Mysqldump-u ajin-P test_db user
> C: \ test_user_table. SQL, press enter and prompt to enter the password.

2. Change the default Character Set of the database during the export process.


For example, I want to export the conversion code of the database test_db to utf8 (utf8 is my most commonly used)


Mysqldump-u ajin-p -- default-character-set = utf8 test_db> C: \ test. SQL
You can.
To convert to other characters, replace utf8
You can.

3. Export data of different versions or data exported to the database

For example, in my database MySQL 4.1, I want to export a default character set.
Utf8 version 4.0 data

Mysqldump-u ajin-P test_db -- compatible = mysql40
-- Default-character-set = utf8 test_db> C: \ test. SQL

The so-called downgrade can be completed.
-- Compatible = the following parameters can be obtained: mysql323 mysql40 Oracle MSSQL DB2
And so on.

Export introduces these common ones, but there are many more .. Omit one thousand words .....

Data Import

 
This is relatively simple. It is used in command line and cmd.
If your msyql/bin directory is not configured in the system environment variables, CD to the MySQL/bin directory first.

For example, if you want to import test. SQL
This data is sent to the discuz_db database.

Mysql-u ajin-P discuz_db
<C: \ test. SQL: Press enter to enter the password. If there is no password,-P is not required.
Now

Now, let's sum up so much. You are welcome to talk about it, but there will inevitably be errors. Please kindly advise ~~

Http://ajin.blog.im286.com/archives/2005/902.shtml

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.