如何使用 MySQL Workbench 更改字段的值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33176332/
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 21:20:15  来源:igfitidea点击:

How to change a value of a field using MySQL Workbench?

mysqldatabasemysql-workbenchrdbms

提问by AndreaNobili

I have installed MySQL Workbenchand I have the following problem.

我已经安装了MySQL Workbench,但遇到了以下问题。

I perform this simple select query:

我执行这个简单的选择查询:

SELECT * FROM spring_security.user;

that returns a list of rows.

返回行列表。

So, in the output area, I select a field of a specific row and I try to change its value. But I can't do it.

因此,在输出区域中,我选择特定行的一个字段并尝试更改其值。但我做不到。

Seems that is is impossible insert a new value for a specific field of a specific row.

似乎不可能为特定行的特定字段插入新值。

Why? How can I use this tool to change a value?

为什么?如何使用此工具更改值?

Tnx

Tnx

采纳答案by scaisEdge

You can do easy with MySql Workbench this way :

您可以通过以下方式轻松使用 MySql Workbench:

in menu database simply connect

在菜单数据库中只需连接

then select the database you need and then the table.

然后选择您需要的数据库,然后选择表。

Positioning the mouse over the table name in table schemas explore and so you can see on the rightside a table icon.

将鼠标放在表模式探索中的表名称上,这样您就可以在右侧看到一个表图标。

Selecting/clicking this icon you can see the date in tabular form (like Toad).

选择/单击此图标,您可以以表格形式查看日期(如 Toad)。

With this tabular form you can edit and apply the change

使用此表格形式,您可以编辑和应用更改

Applying the change MySq Wworkbench show you the sql code and ask for confirm

应用更改 MySq Wworkbench 向您显示 sql 代码并要求确认

回答by landonandrey

Also, you can execute next script:

此外,您可以执行下一个脚本:

UPDATE table SET cell='new_value' WHERE whatever='somevalue'

UPDATE table SET cell='new_value' WHERE whatever='somevalue'

回答by Daryn

Leif Neland's comment on @scaisEdge's answer is the real solution (as indicated by the huge comment-upvote count), so here it is as an answer, to increase its visibility:

Leif Neland 对@scaisEdge 答案的评论是真正的解决方案(如巨大的评论-upvote 计数所示),所以这里是一个答案,以提高其知名度:

Given that:

鉴于:

  • your query selects from just one table (no join)
  • the table has a unique primary key
  • your DB user has permission to UPDATE
  • 您的查询仅从一张表中选择(无联接)
  • 该表有一个唯一的主键
  • 您的数据库用户有权更新

Then, in the Result Grid, you can edit a field by one of the following:

然后,在结果网格中,您可以通过以下方式之一编辑字段:

  • Click a field once to select it (the cursor changes into text cursor), and click a second time to start editing in-place in the Result Grid, or
  • Right click on a the field and select the "Open Value in Editor" option
  • 单击一次字段以将其选中(光标变为文本光标),然后再次单击以开始在结果网格中就地编辑,或
  • 右键单击该字段并选择“在编辑器中打开值”选项

After editing the value, you need to apply it:

编辑完值后,您需要应用它:

The [apply] and [revert] buttons are at the lower right corner of the table.

Leif Neland

[apply] 和 [revert] 按钮位于表格的右下角。

莱夫·内兰

As shown here: enter image description here

如图所示: 在此处输入图片说明