Create user in MySQL
| From: | PHP List | Date: | Sun, 22 Oct 2000 08:00:58 +0000 |
| Subject: | Create user in MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21625@lists.php.net to get a copy of this message | ||
I am having trouble creating a user and db permissions in MySQL. I get the
following error when trying to access a database after creating user and db
permissions:
Warning: MySQL Connection Failed: Access denied for user: 'foo@localhost'
(Using password: YES)
Following are the insert statements I used to create user and db
permissions:
$sql = "INSERT INTO user (Host, User, Password, Select_priv, Insert_priv,
Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv,
Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv,
Index_priv, Alter_priv) VALUES ('localhost', 'foo', PASSWORD('bar'),
'Y',
'Y', 'Y', 'N', 'N', 'N', 'N',
'N', 'N', 'N', 'N', 'N', 'N',
'N')";
$sql = "INSERT INTO db (Host, Db, User, Select_priv, Insert_priv,
Update_priv,
Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv,
Index_priv, Alter_priv) VALUES ('localhost', 'data_base', 'foo',
'Y', 'Y',
'Y',
'N', 'N', 'N', 'N', 'N', 'N',
'N')";
The above informatin is being correctly inserted into the user and db tables
of the database. I have viewed the info and it looks to be consistant with
how it should be. Do I need to insert information into any other mysql db
tables?
I appolize that this is not specifically a PHP question, but I know there
are a lot of MySQL experts on this list.
Any help would be appreciated as I have been stumped on this for a while.
Thanks,
Scott