Aladdin
Aladdin

Reputation: 221

change server system variables mysql

how I can change server system variables in MySql ?

will , i want to dispose of the warning :

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

when i want to change the explicit_defaults_for_timestamp to enable , i use this statement :

mysqld --explicit_defaults_for_timestamp=TRUE;

after that i rerun the "mysqld" , the same warning appear .

and when i check the server system variables by statement :

mysqld --verbose --help

I see that my first statement did not change the variable explicit_defaults_for_timestamp

Upvotes: 1

Views: 2015

Answers (1)

AbsoluteƵERØ
AbsoluteƵERØ

Reputation: 7870

It's a warning letting you know that the behavior has changed and to fix any databases where the old behavior is expected. Reference explicit_defaults_for_timestamp.

In short, you have to setup your database correctly and actually set the behaviors you want to have happen. If you want a default to be NULL, set it to NULL, if you want it to automatically set the current timestamp, set it to DEFAULT CURRENT_TIMESTAMP.

Before what was happening is you could insert a value as NULL and it would actually default to the current timestamp, so this lazy programming behavior will no longer be allowed. The reason they're warning is because this will break functionality in the future for databases ported to the newer future versions.

They're suggesting you enable the new variable, just to see what will break on your system now, so you can make necessary changes. In the future you will not have the option once you upgrade because:

explicit_defaults_for_timestamp is itself deprecated because its only purpose is to permit control over now-deprecated TIMESTAMP behaviors that will be removed in a future MySQL release. When that removal occurs, explicit_defaults_for_timestamp will have no purpose and will be removed as well.

Upvotes: 1

Related Questions