I'm building a php system that adds and deletes users in mysql. It's currently set up like so: - user attempts to log in to site - looks up username and hash(sha256, salt, password) in projectdb.users (which is also a mysql users credentials) - finds it and then uses that username and password to do any mysql_connect's while logged in
So when I add a user in the system I'm adding their credentials to a table and adding them as a mysql user with minimal permissions only on the projectdb database.
But when I add an admin account I'm giving them full permission to that db and giving them mysql grant/add user permissions so they can add more users. This seems like too much power, even though these users can't directly connect and log into mysql (but if they could they could add anyone).
Instead of actually adding mysql users to the system is it better to hard code a single user and admin's permissions in the php files? Is there a safer way than those two ideas?