tags:

views:

48

answers:

2

what MySQL permissions are required for mysql_real_escape_string()?

i want to create a db user with the minimum abilities specifically for using with mres()...

+4  A: 

It's done on the client side, so the only permission needed is usage (since all you need is a connection, not even read permissions)...

ircmaxell
The **USAGE** permission stands for "No Privileges" mainly in MySQL.
Knowledge Craving
Actually no. `Usage` allows you to log in and select the database. You can't do anything else, but you can get access. And since `mysql_real_escape_string` only requires a connection, all you need is access. So yes, `USAGE` is sufficient for `mysql_real_escape_string`. Sure, you can't do anything else, but you can do what the original question was...
ircmaxell
and nobody wondered why such a question. I wish there was a habit on SO, kind of tradition.. to think at least once per 10 answers...
Col. Shrapnel
A: 

EDIT, after comments of "ircmaxell":-
You will require the following permissions / privileges to be set:-

  1. INSERT
  2. SELECT
  3. UPDATE
  4. CREATE TEMPORARY TABLES

The above privileges are the minimum ones that should be provided to any user account of each & every database of MySQL.

If administrator wants to create just a basic simple account, where the user will need to view / select the records, then only the "SELECT" permission is just required. No other permissions are needed to be given (as regards to the comment of "ircmaxell").

Hope it helps.

Knowledge Craving
Never add `ALTER` or `INDEX` permissions for a production account. If you application modifies tables dynamically, you **really** need to rethink the problem... Only administrators (And internal administration applications) should have those two permissions...
ircmaxell
@ircmaxell - Thanks for the info, I'm changing my answer accordingly.
Knowledge Craving
@Knowledge Craving: Removed -1... Otherwise that is a good baseline of permissions (depending on need of course. You may want some accounts to only have `SELECT`)...
ircmaxell