Search code examples
phpmysqldatabaseprivileges

Block access to Mysql Table inside Database


I have a website and a mysql db with 5 tables. One of them includes around 500 user emails. I am outsourcing the development of new features and I would like to block the access to the developer to the table that includes the user emails. The developer will have access to the whole database because he needs to add new tables, but I would like to stop him from accessing the user emails table.

Is there any way to do it?


Solution

  • MySQL has GRANT/REVOKE statements to limit the access right to some tables based on the user that is connected.

    You will probably have to create a new user in your DB an REVOKE the unnecessary rights on the table(s) you want to lock for that user.

    Here is the full list of privileges supported by MySQL: http://dev.mysql.com/doc/refman/5.0/en/grant.html#grant-privileges