解决办法:http://see.sl088.com/wiki/Explicit_defaults_for_timestamp
解决
进入/etc/my.cnf,增加一项设置
# seem 5.6 need this
explicit_defaults_for_timestamp = 1
有个哥们遇到时的一个记录备案!
对MYSQL了解甚少,毕业设计小组统一使用MYSQL,所以今天尝试安装了MYSQL5.6。大多数开发工具安装过程都是傻瓜式的,MYSQL也不例外,正适合我这种人,不爱动脑子。安装过程中涉及到创建用户什么的,但无法创建成功,具体错误没有记录下来。
用command line client尝试登陆,提示输入密码(安装过程需要设置密码),但输入密码后敲回车键后窗口迅速消失,且看不清提示代码,使用navicate for mysql连接时报错,“ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)”。
这个提示有点诡异,于是上网搜索一番。
有人怀疑win7安装MYSQL时不是以管理员身份安装,需重新设置密码即可,搞不清楚!在网上搜索了很多修改密码的方法,如“mysqld -nt -skip-grant-tables,然后再mysqladmin -u root flush-privileges password”,但是执行前一句时提示
“[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentation for more details).”,这更不知道怎么回事了。
然后继续不假思索地搜索,官网给出的答案是As indicated by the warning, to turn off the nonstandard behaviors, enable the new explicit_defaults_for_timestamp system variable at server startup. With this variable enabled, the server handlesTIMESTAMP as follows instead:
TIMESTAMP columns not explicitly declared as NOT NULL permit NULL values. Setting such a column toNULL sets it to NULL, not the current timestamp.
No TIMESTAMP column is assigned the DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP attributes automatically. Those attributes must be explicitly specified.
TIMESTAMP columns declared as NOT NULL and without an explicit DEFAULT clause are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. If strict SQL mode is enabled, an error occurs. If strict SQL mode is not enabled, the column is assigned the implicit default of '0000-00-00 00:00:00' and a warning occurs. This is similar to how MySQL treats other temporal types such as DATETIME.
重点是“enable the new explicit_defalut_for_timestaemp system variable”,具体怎么实现还是一头雾水。
接着搜,有说在my.ini文件中mysql下添加explicit_defalut_for_timestamp,重启电脑(习惯了),执行mysqld -nt -skip-grant-tables,还是报同样的错误,一直在那里纳闷,有点想放弃使用mysql的念头。
后来尝试执行mysqladmin -u root flush-privileges password,输入新密码,居然成功登录进去了!
所以说解决方法是懂得灵活变通很重要,网上那种方法表面看上去是先执行mysqld -nt -skip-grant-tables,再执行mysqladmin -u root flush-privileges password的,但变通一下,反而成了。
幸好自己没有过早放弃,否则又失去接触MYSQL的机会咯。
来自:http://blog.sina.com.cn/s/blog_a231411c0101cpm4.html
解决
进入/etc/my.cnf,增加一项设置
# seem 5.6 need this
explicit_defaults_for_timestamp = 1
有个哥们遇到时的一个记录备案!
对MYSQL了解甚少,毕业设计小组统一使用MYSQL,所以今天尝试安装了MYSQL5.6。大多数开发工具安装过程都是傻瓜式的,MYSQL也不例外,正适合我这种人,不爱动脑子。安装过程中涉及到创建用户什么的,但无法创建成功,具体错误没有记录下来。
用command line client尝试登陆,提示输入密码(安装过程需要设置密码),但输入密码后敲回车键后窗口迅速消失,且看不清提示代码,使用navicate for mysql连接时报错,“ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)”。
这个提示有点诡异,于是上网搜索一番。
有人怀疑win7安装MYSQL时不是以管理员身份安装,需重新设置密码即可,搞不清楚!在网上搜索了很多修改密码的方法,如“mysqld -nt -skip-grant-tables,然后再mysqladmin -u root flush-privileges password”,但是执行前一句时提示
“[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentation for more details).”,这更不知道怎么回事了。
然后继续不假思索地搜索,官网给出的答案是As indicated by the warning, to turn off the nonstandard behaviors, enable the new explicit_defaults_for_timestamp system variable at server startup. With this variable enabled, the server handlesTIMESTAMP as follows instead:
TIMESTAMP columns not explicitly declared as NOT NULL permit NULL values. Setting such a column toNULL sets it to NULL, not the current timestamp.
No TIMESTAMP column is assigned the DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP attributes automatically. Those attributes must be explicitly specified.
TIMESTAMP columns declared as NOT NULL and without an explicit DEFAULT clause are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. If strict SQL mode is enabled, an error occurs. If strict SQL mode is not enabled, the column is assigned the implicit default of '0000-00-00 00:00:00' and a warning occurs. This is similar to how MySQL treats other temporal types such as DATETIME.
重点是“enable the new explicit_defalut_for_timestaemp system variable”,具体怎么实现还是一头雾水。
接着搜,有说在my.ini文件中mysql下添加explicit_defalut_for_timestamp,重启电脑(习惯了),执行mysqld -nt -skip-grant-tables,还是报同样的错误,一直在那里纳闷,有点想放弃使用mysql的念头。
后来尝试执行mysqladmin -u root flush-privileges password,输入新密码,居然成功登录进去了!
所以说解决方法是懂得灵活变通很重要,网上那种方法表面看上去是先执行mysqld -nt -skip-grant-tables,再执行mysqladmin -u root flush-privileges password的,但变通一下,反而成了。
幸好自己没有过早放弃,否则又失去接触MYSQL的机会咯。
来自:http://blog.sina.com.cn/s/blog_a231411c0101cpm4.html
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/6322/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2013-5-6 17:55
评论列表