Page 1 of 1

Create a mysql database and set permissions using php

Posted: Mon Jun 30, 2003 12:28 pm
by eruiz1973
I need to have a php file that creates a mysql database and also sets permissions as follows:

GRANT ALL PRIVILEGES ON `demo` . * TO "coldfusion"@"localhost" WITH GRANT OPTION ;

GRANT ALL PRIVILEGES ON `forum` . * TO "any"@"www" WITH GRANT OPTION ;

as well as


GRANT ALL PRIVILEGES ON `forum` . * TO "any"@"localhost" WITH GRANT OPTION ;

Thanks

Posted: Mon Jun 30, 2003 1:05 pm
by Stoker
execute as any other query??? just that the user you do this with must have superuser access.. (to create database)

mysql_query ('CREATE DATABASE mybeer');
mysql_query ('GRANT ALL ON mybeer TO ...');

Posted: Mon Jun 30, 2003 1:24 pm
by eruiz1973
Thanks. I've never used php so it's a little complex for me to understand the query. What you wrote is all I need in the php code page?

Thanks
Em

Posted: Tue Jul 01, 2003 3:14 am
by twigletmac
Moved this to Databases as it did not belong in PHP - Advanced.

Mac