MySQL Forums
Forum List  »  MySQL Workbench

Re: Individual field rights in the same table
Posted by: Barry Galbraith
Date: April 16, 2024 04:32PM

HeidiSQL is another GUI which can interface with MySQL and other RDBMS. It runs on Windows.
It's MYSQL user admin allows you to grant/revoke privileges on Database objects down to table columns.

I can't find a "GUI way" in Workbench to manage column privileges, but can do it with SQL commandline while referring to the MySQL manual

https://dev.mysql.com/doc/refman/8.0/en/grant.html#grant-column-privileges

You can demonstrate this in a Query tab in Workbench with this script.
CREATE DATABASE IF NOT EXISTS test;
USE test;
CREATE TABLE `new_table` (
  `id` int NOT NULL AUTO_INCREMENT,
  `tablecol` varchar(45),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

CREATE USER test_user IDENTIFIED BY 'password';
GRANT SELECT(tablecol) ON test.new_table TO test_user;

The SELECT on tablecol in new_table is then displayed in the column privileges window.
I found that when test_user is created, it won't display in the Administration / Users and privileges screen unless you re-connect to your MySQL server. Refresh button has no effect.

Good luck,
Barry.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Individual field rights in the same table
193
April 16, 2024 04:32PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.