I was working on a PHP script the other day which populated a database with some tables, data, and a view. During testing, it was discovered the script would error out for database users that didn’t have the CREATE VIEW privilege. Since the view was a requirement of the project, I had to first check the users database rights. If they couldn’t create a view, the script should error out and inform them their database user needs those rights.
MySQL gives us a way to check a users rights. You can test this by running the following query when you are logged into your server. The following indicates I have full rights when I am logged in as justin.
/* the query */ SHOW GRANTS; /* the result */ GRANT ALL PRIVILEGES ON *.* TO 'justin'@'localhost' WITH GRANT OPTION
















