How can I set a "root" password in MySQL? (method 1)
How can I set a "root" password in MySQL? (method 2)
How can I set a "root" password in MySQL (method 3)
When you want to create additional users, you can create a PHP page that connects root to the database mysql and do an insert query into the users table by identifying the username, password, and any select privileges, then flush privileges. Then, you can insert into the db table with the user name. Since the tables have enum properties, you'll need to type 1 for no and 2 for yes. Here's an example.
mysql_query("INSERT INTO user (host,user,password,create_priv,delete_priv,drop_priv,insert_priv,select_priv,update_priv) VALUES('localhost','$username',PASSWORD('$password'),'2','2','2','2','2','2')");
mysql_query("FLUSH PRIVILEGES");
Then you'll have to insert the user into the database with the following code:
mysql_query("INSERT INTO db (host,db,user,create_priv,delete_priv,drop_priv,insert_priv,select_priv,update_priv) VALUES('localhost','$database','$username','1','1','1','1','2','1')");
so that you can give this user create, delete, drop, insert, select, and update globally but only select locally on that database.