Why not use the built-in MySQL users and permissions for a website?
The link above explains the dilemma that I am in very well.
I have an application where users register to it by providing username and password. There is additional information which can be stored on a separate table (one for all users) that relate back to the user name. In addition, I want to restrict the users to only one table where events specific to that user are stored using GRANT. To use grant, a MySQL user account is required. The question then becomes, is there anything wrong with a MySQL user to be also the application user?
I've read a few posts that keep advising to implement my own authentication as well as access system, why re-invent the wheel? I haven't encountered anything on the MySQL page advising against the link above.
EDIT
I created a user with the following statement
CREATE USER 'test'@'localhost' IDENTIFIED BY 'testing';
Followed by the grant privileges
GRANT CREATE USER ON *.* to 'test'@'localhost';
I then log-on as this user and do the following commands:
mysql> show grants;
+-----------------------------------------------------------------------------------------+
| Grants for tester@localhost |
+-----------------------------------------------------------------------------------------+
| GRANT CREATE USER ON *.* TO 'tester'@'localhost' IDENTIFIED BY PASSWORD '*AC57754462B6D4C373263062D60EDC6E452E574D' |
+-----------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)
mysql> use mysql
ERROR 1044 (42000): Access denied for user 'tester'@'localhost' to database 'mysql'
I believe the only issue here would be the DROP USER command. Is there any way to prevent that?
mysql> DROP USER 'root'@'localhost'; ERROR 1396 (HY000): Operation DROP USER failed for 'root'@'localhost'