Mysql written in linux cannot be inserted, and the SQL statement becomes & #39; dirty & #39; during replication.

Source: Internet
Author: User
1: The fault description is developed in linux. When modifying the mysql field, you can use phpmyadmin to directly modify and generate the modified SQL statement, and then copy it to word (libreoffice) after submission to the Project Management System, a colleague cannot run after being sent to the project management system. so with this article. 2: first create the CREATETABLEIFNOTEXISTS 'nns _

1: The fault description is developed in linux. When modifying the mysql field, you can use phpmyadmin to directly modify and generate the modified SQL statement, and then copy it to word (libreoffice) after submission to the Project Management System, a colleague cannot run after being sent to the project management system. so with this article. 2: First create table if not exists 'nns _

1: fault description

Because it is developed in linux, phpmyadmin is used to directly modify the mysql field to generate the modified SQL statement, copy it to word (libreoffice), and submit it to the project management system,

My colleagues cannot run after being sent to the project management system.


2: Create a table first

Create table if not exists 'nns _ ad_log_count '('nns _ id' char (32) character set utf8 COLLATE utf8_unicode_ci not null comment 'ad id ', 'nns _ access_type 'tinyint (4) not null comment '0: 5 m 1: 1 h 2: 24 h = 1d ', 'nns _ access_day 'date not null comment' which day', 'nns _ access_index 'int (11) not null comment' interval, 5 m 1 h 1d = 24 h ', 'nns _ access_count 'int (11) not null) ENGINE = InnoDb default charset = utf8;

This step is OK.

Then, one field is added due to project extension, and the field names of one table and the default values and types of other tables need to be modified.

Alter table 'nns _ ad_log_count 'CHANGE 'nns _ id' 'nns _ ad_id' CHAR (32) character set utf8 COLLATE utf8_unicode_ci not null comment 'ad id ';

In the preceding step, an SQL statement is generated after the field added by phpmyadmin. It seems that there is no problem. Copy it to word and run it in mysql.


An error is reported. I cannot explain it,

Why?


3: error analysis.

The generated SQL statement is clean. On the way, the colleague only pasted it into word.

So I wrote this SQL statement and run it in mysql. (for testing, I copied the table structure and created a test table named 'nns _ ad_log_count1 ')


Running properly

The colleague copied it only once and pasted it to the word (libreoffice)

I will repeat his actions

"1. Open phpmyadmin in the browser and modify it once directly in phpmyadmin to generate an SQL statement"

"2. In phpmyadmin, copy the generated SQL to the system clipboard cache"

"3. paste it into word"

"4. Repeat other modification operations. Repeat steps 1, 2, and 3"

"5. Send the entire word to me"

"6. I copied the SQL statement in word and ran it"

"7. error"

Open word and find that the space of SQL statements is highlighted in word.


However, the preceding SQL statement is executed in phpmyadmin and cannot be seen directly in mysql.


The space is displayed. What is it?

Since then, the problem has been clarified that SQL statements are contaminated after being copied to word. But why is it so polluted? It is found that only after the word is pasted in, will the space under utf8 be replaced?

This should be a problem with the office tool in linux. I will not describe it here.


4: Postscript: the SQL statement for development and submission in linux,

We recommend that you copy it to vim to view the detailed format,

Or, more simply, copy the file in the address bar of the browser and then copy it to the word to submit the document. This prevents SQL errors from getting corrupted.

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.