Minor differences between MySQL in Windows and Linux

Source: Internet
Author: User

The little things found during program tuning today.

In Windows, if the key value is default null and ''is inserted, an error occurs.

If mysql is running in Linux, the value of 0 in the same table is as follows:

The table creation statement is the same. Create a table under win and Linux.

Create table test (
A int (11 ),
B char (11 ),
C varchar (20 ));

Run the following statement and corresponding results in window:

Mysql> insert into test set a = '';
ERROR 1366 (HY000): Incorrect integer value: ''for column 'A' at row 1
Mysql> insert into test set a = 'a ';
ERROR 1366 (HY000): Incorrect integer value: 'A' for column 'A' at row 1

Mysql> insert into test set a = '1 ';
Query OK, 1 row affected (0.02 sec)

Mysql> select * from test;
+ ------ +
| A | B | c |
+ ------ +
| 1 | NULL |
+ ------ +

Run the following statement and corresponding results in Linux:

Mysql> insert into test set a = '';
Query OK, 1 row affected, 1 warning (0.00 sec)

Mysql> insert into test set a = 'a ';
Query OK, 1 row affected, 1 warning (0.00 sec)

Mysql> select * from test;
+ ------ +
| A | B | c |
+ ------ +
| 0 | NULL |
| 0 | NULL |
+ ------ +

It is found that in Windows, data cannot be inserted if it does not conform to the int type. in Linux, it is converted to 0 for storage.

Execute select * from Test and select * from TEsT under Widnows to retrieve data from the test table.

In Linux, the system will prompt that Test or TEsT Linux cannot be found, which is case sensitive.

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.