MySQL 5.6 Timestamp with implicit DEFAULT value is deprecated error _mysql

Source: Internet
Author: User
Tags crc32 deprecated documentation localhost mysql rollback

When MySQL is installed, there are warning:

[Root@localhost mysql]# scripts/mysql_install_db--user=mysql installing MySQL system tables ... 2015-08-13 14:20:09 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use--explicit_defaults_for_timestamp server option (the documentation for more details).
2015-08-13 14:20:09 0 [note]./bin/mysqld (mysqld 5.6.26) starting as process 1934 ... 2015-08-13 14:20:09 1934 [note] innodb:using mutexes to ref count buffer pool pages 2015-08-13 14:20:09 1934 [note] Innod B:the InnoDB memory heap are disabled 2015-08-13 14:20:09 1934 [note] innodb:mutexes and rw_locks use InnoDB ' s own Implem Entation 2015-08-13 14:20:09 1934 [note] innodb:memory barrier ' not ' used 2015-08-13 14:20:09 1934 [note] Innodb:compre ssed tables use zlib 1.2.3 2015-08-13 14:20:09 1934 [note] innodb:using Linux native AIO 2015-08-13 14:20:09 1934 [note] Innodb:not using CPU CRC32 instructions 2015-08-13 14:20:09 1934 [note] innodb:initializing buffer pool, size = 128.0M 2 015-08-13 14:20:09 1934 [Note] innodb:completed initialization of buffer pool 2015-08-13 14:20:10 1934 [note] Innodb:the-A-specified data fil
E./ibdata1 did not exist:a new database to is created! 2015-08-13 14:20:10 1934 [note] innodb:setting file./ibdata1 size to MB 2015-08-13 14:20:10 1934 [note] Innodb:datab
ASE physically writes the file full:wait ... 2015-08-13 14:20:10 1934 [note] innodb:setting log file./ib_logfile101 size to MB 2015-08-13 14:20:11 1934 [note] Inn odb:setting log file./ib_logfile1 size to MB 2015-08-13 14:20:12 1934 [note] innodb:renaming log file./ib_logfile10 1 to./IB_LOGFILE0 2015-08-13 14:20:12 1934 [Warning] innodb:new log files created, lsn=45781 2015-08-13 14:20:12 1934 [N 
OTE] Innodb:doublewrite buffer not found:creating new 2015-08-13 14:20:12 1934 [note] Innodb:doublewrite buffer created
2015-08-13 14:20:12 1934 [note] innodb:128 rollback segment (s) are active. 2015-08-13 14:20:12 1934 [Warning] innodb:creating FOREIGN KEY constraint system tables.
2015-08-13 14:20:12 1934 [note] innodb:foreign key constraint system tables created 2015-08-13-14:20:12 1934 [note] Inno
Db:creating tablespace and datafile system tables.
2015-08-13 14:20:12 1934 [note] innodb:tablespace and datafile system tables created.  2015-08-13 14:20:12 1934 [note] innodb:waiting for purge to start 2015-08-13 14:20:12 1934 [note] innodb:5.6.26 started; Log sequence number 0 2015-08-13 14:20:14 1934 [note] Binlog end 2015-08-13 14:20:14 1934 [note] Innodb:fts optimize
EAD exiting.
2015-08-13 14:20:14 1934 [note] innodb:starting shutdown ... 2015-08-13 14:20:16 1934 [note] Innodb:shutdown completed; Log sequence number 1625977 OK Filling help tables ... 
2015-08-13 14:20:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use--explicit_defaults_for_timestamp server option (the documentation for more details).
2015-08-13 14:20:16 0 [note]./bin/mysqld (mysqld 5.6.26) starting as process 1957 ... 2015-08-13 14:20:16 1957 [note] InnodB:using mutexes to ref count buffer pool pages 2015-08-13 14:20:16 1957 [?] innodb:the InnoDB memory heap is disabled 2015-08-13 14:20:16 1957 [note] innodb:mutexes and rw_locks use InnoDB ' s own implementation 2015-08-13 14:20:16 1957 [No  TE] innodb:memory barrier is isn't used 2015-08-13 14:20:16 1957 [note] innodb:compressed tables use zlib 1.2.3 2015-08-13 14:20:16 1957 [note] innodb:using Linux native AIO 2015-08-13 14:20:16 1957 [note] Innodb:not Using CPU CRC32 instructi ONS 2015-08-13 14:20:16 1957 [note] innodb:initializing buffer pool, size = 128.0M 2015-08-13 14:20:16 1957 [note] InnoDB : Completed initialization of buffer pool 2015-08-13 14:20:16 1957 [note] Innodb:highest supported the file format is Barracu
Da.
2015-08-13 14:20:16 1957 [note] innodb:128 rollback segment (s) are active.  2015-08-13 14:20:16 1957 [note] innodb:waiting for purge to start 2015-08-13 14:20:16 1957 [note] innodb:5.6.26 started; Log sequence number 1625977 2015-08-13 14:20:17 1957 [note] BinloG End 2015-08-13 14:20:17 1957 [note] innodb:fts optimize thread exiting.
2015-08-13 14:20:17 1957 [note] innodb:starting shutdown ... 2015-08-13 14:20:18 1957 [note] Innodb:shutdown completed; Log sequence number 1625987 OK to start mysqld in boot time for your have to copy Support-files/mysql.server to the right plac
E for your system, REMEMBER to SET A PASSWORD for the MySQL root USER! To does so, start the server, then issue the following commands:./bin/mysqladmin-u root password ' new-password './bin/m Ysqladmin-u root-h localhost.localdomain password ' new-password ' Alternatively you can run:./bin/mysql_secure_instal Lation which'll also give you the option of removing the test databases and anonymous user created by default.

This is strongly recommended for production servers.

The manual for more instructions. You can start the MySQL daemon with:cd. ;./bin/mysqld_safe & can test the MySQL daemon with mysql-test-run.pl CD mysql-test; Perl MySQL-test-run.pl please have a problems at Http://bugs.mysql.com/The latest information about MySQL are available on the  Web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com New Default Config file
was created as./my.cnf and would is used by default to the server when you start it. You could edit this file to change server Settings Warning:default config FILE/ETC/MY.CNF exists on the system this file 'll be read by default through the MySQL server If you don't want to use this, either remove it, or use the--defaults-file a Rgument to Mysqld_safe when starting the server [Root@localhost mysql]#

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (the documentation for more details).

The reason for this is that since 5.6, timestamp's default behavior has been deprecated.

The default behavior of timestamp before MySQL 5.6.6:

timestamp column If the null attribute is not explicitly declared, the default is not NULL. (Other data types, if not declared as NOT NULL, allow null values.) Sets the timestamp column value to null and is automatically stored as the current timestamp.
• The first TIMESTAMP column in the table, if no null property, default, or on update is declared, the DEFAULT current_timestamp and on Update Current_timestamp properties are automatically assigned.
• The second timestamp column in the table, if not declared as NULL or DEFAULT clause, automatically assigns ' 0000-00-00 00:00:00′. Inserting a row does not indicate the value of the Change column, which is assigned the ' 0000-00-00 00:00:00′ by default and has no warning.

To turn off warnings, you need to add the following parameters:

[Mysqld]
Explicit_defaults_for_timestamp=true

After restarting MySQL, the error disappears, then timestamp's behavior is as follows:

timestamp if the declaration not NULL is not displayed and is a null value, you can set the column to NULL instead of the default fill behavior.
The default Current_timestamp and on UPDATE current_timestamp properties are not assigned by timestamp.
• Timestamp columns that are declared NOT NULL and have no default clause are not default values. When you insert a column into a datasheet without assigning a value to the timestamp column, if you are in strict SQL mode, an error is thrown, and if the strict SQL mode is not enabled, the column is assigned a value of ' 0000-00-00 00:00:00′ and a warning appears. (This is the same as MySQL processing other time type data, such as DateTime)
(See also: http://www.jb51.net/article/71054.htm)

That is, Explicit_defaults_for_timestamp closes the timestamp type field lock has some strange default behavior, after the argument is added, if you also want to specify default behavior for fields of type timestamp, Then you need to display the designation that appears when you create the table. Explicit_defaults_for_timestamp is the meaning of this: Displays a field that specifies the default value of timestamp type.

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.