MySQL Username and Pass w/PHP
Hey, I wanted to know how I can create a new user for MySQL through PHP using variables from a form.
I am creating a script that installs another script that I'm planning to write. The user inserts a database name, database password, and username, and I want the script to create all three of those things. (In short, its using the variables to define what the username and password for the database they create will be.
If anyone can help, that would be great.
(If it helps, teh variables for the three are:
1) $databasename (for the database name)
2) $username (for the username)
3) $password (for the password))
Thanks,
Frank
Mark Hensler posted this at 01:06 — 12th May 2004.
He has: 4,048 posts
Joined: Aug 2000
You will have to run SQL statements from a user with the apropriate permissions (root, mostlikely). There isn't anything special you have to do in PHP. Just run the SQL statements (with mysql_query, etc.).
Mark Hensler
If there is no answer on Google, then there is no question.
phr4nk posted this at 01:20 — 12th May 2004.
They have: 2 posts
Joined: May 2004
And those statements would be?
(Hehe, I'm a no0b, I need spoon feeding here.)
s0da posted this at 03:15 — 12th May 2004.
He has: 157 posts
Joined: Mar 2004
http://www.php.net/mysql
Mark Hensler posted this at 03:56 — 12th May 2004.
He has: 4,048 posts
Joined: Aug 2000
More info here:
http://dev.mysql.com/doc/mysql/en/Adding_users.html
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.