MYSQL UPDATE日期字段不起作用

时间:2021-07-23 00:10:45

Why won't this work:

为什么这不起作用:

USE presentations_db; UPDATE presentations_tbl SET `date` = '2012-12-13' WHERE `date` = '2013-12-12'

I have tried everywhere I could and can't find an answer.

我到处都试过,找不到答案。

date is the field name so used back ticks as required. date is of DATE data type.

date是字段名称,因此根据需要使用返回刻度。 date是DATE数据类型。

1 个解决方案

#1


0  

I managed to get it to run through the commandline. I clicked on "command line client" and it asked for a password. I then ran the sql statement and got the following result:

我设法通过命令行运行它。我点击“命令行客户端”,它要求输入密码。然后我运行sql语句并得到以下结果:

mysql> UPDATE `presentations_db`.`presentations_tbl`SET date_ = '2012-12-13' WHERE date_ = '2013-12-12';
Query OK, 16 rows affected (0.06 sec) Rows matched: 16 Changed: 16 Warnings: 0

When I tried to run the same query by simply running mysql though a shell it came up with an error that the db can not be edited by localhost, which is more explanatory than 'Query interrupted'. This seems to be a gripe previously covered in http://bugs.mysql.com/bug.php?id=67766. It would be nice if somone can tell me what I am doing wrong in workbench gui. I normally do the following when trying to run queries. I click on 'Edit Table Data' and the select the database and tables. It seems like I can view and run select queries but not update queries.

当我试图通过简单地通过shell运行mysql来运行相同的查询时,它出现了一个错误,即本地主机无法编辑数据库,这比“查询中断”更具说明性。这似乎是http://bugs.mysql.com/bug.php?id=67766中所述的抱怨。如果somone可以告诉我在工作台gui中我做错了什么会很好。我通常在尝试运行查询时执行以下操作。我点击“编辑表格数据”并选择数据库和表格。看起来我可以查看和运行选择查询但不能更新查询。

#1


0  

I managed to get it to run through the commandline. I clicked on "command line client" and it asked for a password. I then ran the sql statement and got the following result:

我设法通过命令行运行它。我点击“命令行客户端”,它要求输入密码。然后我运行sql语句并得到以下结果:

mysql> UPDATE `presentations_db`.`presentations_tbl`SET date_ = '2012-12-13' WHERE date_ = '2013-12-12';
Query OK, 16 rows affected (0.06 sec) Rows matched: 16 Changed: 16 Warnings: 0

When I tried to run the same query by simply running mysql though a shell it came up with an error that the db can not be edited by localhost, which is more explanatory than 'Query interrupted'. This seems to be a gripe previously covered in http://bugs.mysql.com/bug.php?id=67766. It would be nice if somone can tell me what I am doing wrong in workbench gui. I normally do the following when trying to run queries. I click on 'Edit Table Data' and the select the database and tables. It seems like I can view and run select queries but not update queries.

当我试图通过简单地通过shell运行mysql来运行相同的查询时,它出现了一个错误,即本地主机无法编辑数据库,这比“查询中断”更具说明性。这似乎是http://bugs.mysql.com/bug.php?id=67766中所述的抱怨。如果somone可以告诉我在工作台gui中我做错了什么会很好。我通常在尝试运行查询时执行以下操作。我点击“编辑表格数据”并选择数据库和表格。看起来我可以查看和运行选择查询但不能更新查询。