read-only mode

dbuser297 posted 5 years ago in General
Is there really no option to mark some databases or tables as read-only after opening HeidiSQL or even to open HeidiSQL in read-only mode (i.e., everything is read-only)?
jfalch posted 5 years ago
ansgar posted 5 years ago
Well, you can do that very effectively by restricting your user privileges in that database to SELECT. That is not an option in HeidiSQL itself.
doomy posted 2 years ago

In my case I don't administrate the db users myself. I guess I could ask for the write privileges to be revoked from my user, but there's a good chance I will need those ocasionally. Typically though I don't need the rights, and it would be really great to have an application-level safety mechanism to prevent me from changing something unintentionally.

ansgar posted 2 years ago

Well, I could add a checkbox to the session manager's advanced tab, namely "Read only mode" or so. If activated, what happens then? I'd say

  • grid editing should be blocked with an error message
  • the "save" buttons on the table editor should always be displaying the same error instead of saving changes.
  • same goes for the views, procedures, events and triggers.
  • the "ok" button on the edit/create database dialog should display that error message
  • same for the user manager's ok button
  • same goes for the "ok" button on the CSV import dialog
  • same goes for the "ok" button on the "import files into blobs" dialog
  • same goes for the "execute" button in tools > Maintenance
  • same goes for the "execute" button in tools > SQL export, if output is database or server
  • query tabs will be a problem. Simple queries starting with UPDATE, INSERT or DELETE could be blocked, but complex queries with subqueries and so on cannot be really parsed by HeidiSQL for detecting write operations. So that would be still left up to the user.

This is a whole bunch of changes for a non-reliable feature, huh?

kaizhou posted 1 year ago


I use HeidiSQL a lot. And in the past 6 months, I've made 2 accidental modification to DB. For the 1st time I accidently double clicked on a row, edited its data to other value, and when I move mouse cursor away, it updated the DB. For the 2nd time, I accidently hit Ctrl+C, Ctrl+V while my mouse focus was in select result, ending up inserting a new row to database.

I understand a readonly mode may be too complex. So maybe a confirmation promp mode would help. In that mode, all modifications to DB will prompt a Message box, saying "Do you want to make this chagge to database?"

This will greatly reduce the chance of accidental user mistake.

An alternative solution, maybe just allow user to disable edit via select result panel will do.

Regards, Kai

CaptAm posted 1 year ago

I'll add two my cents to this issue. I just started using HeidiSQL (With MS SQL) and first thing I'd like to have is ReadOnly mode, in addition to that fact I'm using read-only user on SQL.

The main problem - I'm used-to CTRL-INS, SHIFT-INS as copy-paste (not CTRL-C, CTRL-V), but CTRL-INS works as duplicate row.

My suggestion for this feature implementation, if You decide to:

  1. In read-only mode it both CTRL-C and CTRL-INS do just copy-paste, not "duplicate row". Also in read-only mode there will be no GUI commands to delete, insert, etc. For SQL commands, I think it's enough, to find words in whole SQL sentence and ban them like "SQL command UPDATE do not work in read-only mode".

Regards, CaptAm

borislavsabev posted 11 months ago

@ansgar I think it should work exactly as you described in your post.

OR just disable all those controls in the interface which would not work for all of them.

I personally need this feature because I have projects with MySQL configured in a master/slave config. I'd like to be able to set it up so that I cannot by mistake write something to any slave. I actually went into the Advanced tab in the Session Manager to search for this first.


borislavsabev posted 11 months ago

@ansgar I just thought that you can do this in a funny way.

  1. Add the read-only checkbox in the Advanced menu.
  2. If clicked advice the user to set up their user with the RDBMS' priviledge system as read only
  3. Uncheck the checkbox :)

Please login to leave a reply, or register at first.