This is the first time that i will ask a question in this forum.
I am working on a php project in which i have to -through php- create a database and insert some empty tables.
The issue here is that i always get an error message regarding syntax when i try to add privileges to the superuser (for some reason, if i don't, an error message states that i don't have permition to access the database).
Here is the code for creating the database and assigning privileges:
$sql = "CREATE DATABASE IF NOT EXISTS `database` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; ";
$sql .= "GRANT SELECT database.* TO 'superuser'@'localhost' ";
$sql .= "GRANT ALL ON database." TO 'superuser'@'localhost' IDENTIFIED BY 'password'; ";
$sql .= "FLUSH PRIVILEGES";
Can you tell me what did wrong? Thanks in advance!