AndreaNobili
AndreaNobili

Reputation: 42957

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

I have installed MySQL Workbench and I have the following problem.

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?

Upvotes: 31

Views: 57731

Answers (4)

Yelmox
Yelmox

Reputation: 47

This answer may be too late, but in case anyone needs it, MAKE SURE THE TABLE HAS A PK (Primary KEY) if it has a PK you will able to edit it in MySQL Workbanch

Upvotes: 1

ScaisEdge
ScaisEdge

Reputation: 133360

You can do easy with MySql Workbench this way :

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).

With this tabular form you can edit and apply the change

Applying the change MySql Workbench show you the sql code and ask for confirm (the apply button is on the lower right corner of the table)

Upvotes: 38

Daryn
Daryn

Reputation: 5097

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:

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

As shown here: enter image description here

Upvotes: 18

landonandrey
landonandrey

Reputation: 1341

Also, you can execute next script:

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

Upvotes: 4

Related Questions