Categories
Database SQL

Create a New MySQL User that only has access to a Particular Schema and Table

Create New MySQl User with Privileges

GRANT ALL PRIVILEGES ON dbTest.* To 'user'@'hostname' IDENTIFIED BY 'password';

So for example:

Log in to Mysql…

mysql -u [root] -p

Then type:

GRANT ALL PRIVILEGES ON [schema].[table “” not found /]
To '[user]'@'[hostname]' IDENTIFIED BY '[password]';

How to View Current Users and Privileges

SHOW GRANTS;

or

select user,host from mysql.user;