由于“不推荐使用具有隐式默认值的 TIMESTAMP”错误,我无法启动 Mysql 5.6 服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16832646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 17:47:33  来源:igfitidea点击:

I can't start Mysql 5.6 server due to "TIMESTAMP with implicit DEFAULT value is deprecated" Error?

mysql

提问by Tum

Ok, Here is my story, I went to mysql.com site & downloaded the file mysql-5.6.11-winx64.zipinto C:, then I unziped it. Then I went to bin folder & started the server by using this command:

好的,这是我的故事,我去了 mysql.com 站点并将文件下载mysql-5.6.11-winx64.zip到 C:,然后我解压了它。然后我转到 bin 文件夹并使用以下命令启动服务器:

C:\mysql-5.6.11-winx64\bin\mysqld --standalone --local-infile=1

Everything was ok as the Mysql server started smoothly. I then stopped server using this command:

一切正常,因为 Mysql 服务器启动顺利。然后我使用以下命令停止服务器:

C:\mysql-5.6.11-winx64\bin\mysqladmin -u root shutdown

The Server was shutdowned properly.

服务器已正确关闭。

I used this way to start & stop mysql server a few times without any problem.

我用这种方式启动和停止 mysql 服务器几次没有任何问题。

However, yesterday, I started the Mysql server but then, at the end of the day, i turned off my PC while my MySQL server was still in the Starting Mode (ie, i did not shutdown mysql using "bin\mysqladmin -u root shutdown" before turned off my PC).

但是,昨天,我启动了 Mysql 服务器,但是在一天结束时,我关闭了我的 PC,而我的 MySQL 服务器仍处于启动模式(即,bin\mysqladmin -u root shutdown在关闭我的 PC 之前,我没有使用“ ”关闭 mysql )。

Also, when my PC got turned off at that time, the Win 7 was starting to download some packages from the internet to update Win7 so the configuration of win7 could be changed.

另外,当时我的电脑关机了,Win 7开始从网上下载一些包来更新Win7,这样就可以改变win7的配置了。

But today I could not start Mysql Server using the above command as there's an error:

但是今天我无法使用上述命令启动Mysql Server,因为出现错误:

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

I searched over internet & some people said that I have to go to my.cnf file & add this line into:

我在互联网上搜索,有些人说我必须转到 my.cnf 文件并将此行添加到:

explicit_defaults_for_timestamp = TRUE

However, there is no my.cnf file in mysql 5.6, there a lot of cnf file in mysql5.6 but with different names:

但是,mysql 5.6中没有my.cnf文件,mysql5.6中有很多名称不同的cnf文件:

mysql-5.6.11-winx64\data\auto.cnf
mysql-5.6.11-winx64\mysql-test\include\default_client.cnf
mysql-5.6.11-winx64\mysql-test\include\default_my.cnf
mysql-5.6.11-winx64\mysql-test\include\default_mysqld.cnf
mysql-5.6.11-winx64\mysql-test\include\default_mysqld_autosize.cnf
mysql-5.6.11-winx64\mysql-test\include\default_mysqld_ndbd.cnf

I tried to add explicit_defaults_for_timestamp = TRUEinto all above cnf file but no help, i still couln't start mysql

我试图添加explicit_defaults_for_timestamp = TRUE到上述所有 cnf 文件中,但没有帮助,我仍然无法启动 mysql

I don't want to reinstall cos I created a big DB in the current mysql Server.

我不想重新安装 cos 我在当前的 mysql 服务器中创建了一个大数据库。

So how to fix it?

那么如何修复呢?

Note: when first time I ran Mysql server, win7 pop up a message saying something (i couldn't remember) such as "do you allow ... Firewall", so do u think that is causing the issue since Win7 got its configuration updated & somehow it reset the Firewall so the Mysql server couldn't start?

注意:当我第一次运行 Mysql 服务器时,win7 弹出一条消息说一些东西(我不记得了),比如“你允许...防火墙”,所以你认为这是导致问题的原因,因为 Win7 得到了它的配置更新并以某种方式重置了防火墙,因此 Mysql 服务器无法启动?

采纳答案by Tum

@ Galadai, I fixed, I unzip the "mysql-5.6.11-winx64.zip" & then copy the data folder in the old "mysql-5.6.11-winx64" into new "mysql-5.6.11-winx64" but not copy "ib_logfile0" & "ib_logfile1" files, then start the new "mysql-5.6.11-winx64", then it works ok. Thax you for our help anyway.

@ Galadai,我定的,我解压“ mysql-5.6.11-winx64.zip”&然后复制数据文件夹中的老“ mysql-5.6.11-winx64”到新的“ mysql-5.6.11-winx64”,而不是复制“ib_logfile0”和“ib_logfile1”文件,然后启动新“的mysql-5.6.11-winx64 ",然后就可以了。无论如何,谢谢你的帮助。

回答by Galadai

On Windows, the configuration file is my.ini, not my.cnf, which in my case is in

在 Windows 上,配置文件是my.ini,不是my.cnf,在我的情况下是

C:\ProgramData\MySQL\MySQL Server 5.6

Once you've made changes to the .ini file start it with:

对 .ini 文件进行更改后,请使用以下命令启动它:

mysqld --defaults-file="C:\{path to .ini file}\my.ini"