When creating new tables and a user to go along with it, I usually just invoke the following commands:
CREATE DATABASE mydb;
GRANT ALL PRIVILEGES ON mydb.* TO myuser@localhost IDENTIFIED BY "mypassword";
I have never ever needed to utilize the FLUSH PRIVILEGES
command after issuing the previous two commands. Users can log in and use their database and run PHP scripts which connect to the database just fine. Yet I see this command used in almost every tutorial I look at.
When is the FLUSH PRIVILEGES
command really needed and when is it unnecessary?