I was wondering if shared hosts generally grant access to this table to their users.
Would it be ok to rely on it to quickly get the current database structure from within a script?
My idea was to use this information to sanitize input lol. For example: UPDATE table SET field = ?
? can be a parameter (I’m using PDO), but what if I wanted to make field a variable to? Since PDO doesn’t support that, I could use data from the info schema to find out if that column exists…
Any MySQL user will have access to
SELECToninformation_schema, owing to the fact that the user must be able to readinformation_schemato be able to read from databases to which he’s been granted access.You can test this out by creating a new user with only the
SELECTprivilege on a single table in a single database. The user will be able to read anything ininformation_schemarelated to the granted tables in that database, but not anything which hasn’t been granted.From the relevant documentation: