MySQL export table structure and data

Source: Internet
Author: User

Export Database
---uroot-p123456-d dbname > dbname.  ---uroot-p123456-t dbname > dbname.  ---uroot-p123456 dbname > Dbname.sql
To export a specified table in a database
---uroot-p123456-d dbname Test > Test.  ---uroot-p123456-t dbname Test > Test.  ---uroot-p123456 dbname Test > Test.sql
Restores
--DEFAULT-- Restore Database mysql -uroot-p123456 dbname </path/dbname.  -- Restore the database source dbname.  -- view table structure desc wp_users;show CREATE table wp_users \g;
SELECT into outfile Export
SELECT * into OUTFILE ' temp.txt ', ' Optionally enclosed by ' "' LINES TERMINATED by ' \ n '< 1382716800;
LOAD DATA Import
LOAD DATA INFILE '/home/temp.txt', ' optionally enclosed by ' "' LINES TERMINATED by ' \ n '(product_id, Uui D,mac,monitor,win_version,ip,createtime);

Note: Importing a remote server from a local is required to useLOAD DATA LOCAL INFILE

Ensure that Local_infile is open and has permission to load data if the error: Message:the used command is not allowed with this MySQL version

1.MYSQL_CONNECT specifies a fifth parameter 128 test, i.e. mysql_connect ($host, $user, $pwd, False, Client_local_files)

MySQL Extended version in 2.PHP (pending confirmation)

Transferred from: http://itopic.org/mysqldump.html

Follow the public number: lovephp

MySQL export table structure and data

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.