Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to toggle a read-only view in mysql workbench

I am the superuser of a particular database schema. Therefore I have all privileges on the tables in this schema, including ALTER DELETE UPDATE and INSERT.

I am administrating this database using the GUI MySQL Workbench 6.3. I used to select rows and to obtain a read-only result grid, which was convenient because it prevented me from accidentally editing data in my table.

This was indicated by a 'read only' flag in the bottom right corner of the result grid (see below).

'read only' flag in the bottom right corner of the result grid

However, I did not change anything in the structure of the table, and now when I select rows I am able to edit data and the 'read only' flag has disappeared.

I find it a bit unsecure because it would mean I could accidentally edit data in the table by mistyping.

How could I revert to a read-only result display?

like image 731
R. Bourgeon Avatar asked Dec 12 '25 09:12

R. Bourgeon


2 Answers

The rules that allow editing a result set are very strict. The select query must be a plain one - no aggregate functions, no joins, no unions. There must be a primary key which is used to address the records to be changed.

like image 176
Mike Lischke Avatar answered Dec 15 '25 06:12

Mike Lischke


Update: it wasn't necessary to worry about accidentally editing records in the table while not being in read-only mode.

Indeed, if you change a record in the table (in the screenshot below, I changed a year from 2010 to 2020), for this change to be actually committed in the database, you would need to click the "apply" button in the bottom right corner.

Moreover, upon closing the tab, you are asked whether or not you want to save changes. Consequently, if you accidentally edited a record, you just have to click "Don't save" upon closing the tab.

enter image description here

like image 29
R. Bourgeon Avatar answered Dec 15 '25 06:12

R. Bourgeon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!