Build 3,000 data in MySQL (3 methods)

Source: Internet
Author: User
Tags mysql view

Method one: Stored procedures

1. The stored procedure is as follows:

delimiter $$DROP PROCEDURE IF EXISTSDataCREATE PROCEDUREDatainchIint)BEGIN     whileI<  the DoINSERT  intoGoodsVALUES("','Hammer Phone', i); SETI=I+1; END  while;End$$Set @id=0; call Proll (@id);

2. Empty the data in the table before executing the stored procedure

3) The time required for the stored procedure to execute: 0.312 seconds

4) After executing the stored procedure, view the data in the table, such as:

question:goods_id is of type int, is there a maximum of 1000 data in a table?

--No, a page of 1000 data, the lower right corner has page 0-0.

Turn the page to see all the data. Such as:

Method two: Using Data Factory DataFactory

datafactory:http://download.csdn.net/detail/terrly88/9098673

ODBC Driver: http://download.csdn.net/detail/terrly88/9098693

1, the initial implementation of success, the database has no data;

ODBC driver version problem, change to 5.0 or more.

2, after the replacement version, began to build 3,000 data, the following steps:

1) Add ODBC, I am connected to the database in the virtual machine test

2) Set the amount of data created

3. Start setting values for each field in the table

A) name setting, random value from table animal

b) Owner Settings

c) Age Settings

d) the setting of date

4. Empty the Pet table

With the command: DELETE from pet;

5, click to run, after successful execution, the prompt to spend the time, as follows:

6. Check if the records and the number of data bars in the database table are correct

With command: SELECT COUNT (*) from pet;

Small knowledge:

1) Delete table data method: delete from table name; TRUNCATE TABLE name;

Method Three: Realize with LoadFile way

1. Using the load data local infile

Here's how to view the MySQL Help documentation for this method, the steps to successfully insert the data:

1) The contents of the prepared data document are as follows:

Note: The Set field value is empty, you can write "\ n"

2) upload to server/var/lib/mysql/directory: Use the RZ command

3) with the command:

Load data local infile '/var/lib/mysql/abc.txt ' into table pet;

View data table after success

4) Prepare 3,000 data and import into the pet table

I use Excel table to make data, the data content is as follows:

Upload to the server and execute the command

2, try to import a Chinese-language

When making the data, if the file has Chinese words, after importing, in the Linux MySQL view table display is normal, as follows:

problem: but using the tool to view the contents of the table just imported, is garbled, did not find the reason, in the end why? is the character set different?

Workaround:

Click on a connection-properties-Switch to Advanced tab – Remove the tick "use MySQL character set" option – Select 65001 (UTF-8) or 10008-gb2312 at "encode", then open to display Chinese correctly.

2015-09-11 17:20:59

Build 3,000 data in MySQL (3 methods)

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.