|
-
May 12th, 2005, 07:37 AM
#1
Thread Starter
Lively Member
Creating db
Im using mysql for a db server. I am wonering what the query would be to create a database and assign it a username and password using sql if possible.
Thanks,
-
May 12th, 2005, 10:14 AM
#2
Re: Creating db
Have a look at this, it may help you 
Cheers,
RyanJ
-
May 12th, 2005, 11:05 AM
#3
Thread Starter
Lively Member
Re: Creating db
Thats not really what i was looking for, but thanks anyways. I know how to create a db, but when i do it has no username or password set for it. What i want to do is be able to set a username and password for the database when i create it.
-
May 12th, 2005, 11:08 AM
#4
Re: Creating db
Ah, Sorry I miss-understood your question.
I don't think this is possible in PHP, if it were then you could create / edit databases through PHP at will and this could pose some security risks.
Cheers,
RyanJ
-
May 12th, 2005, 11:28 AM
#5
Thread Starter
Lively Member
Re: Creating db
 Originally Posted by sciguyryan
Ah, Sorry I miss-understood your question.
I don't think this is possible in PHP, if it were then you could create / edit databases through PHP at will and this could pose some security risks.
Yeah, i guess i was kinda thinking more along the lines of doing it in SQL. Im sure there has got to be a way of doing it.
-
May 12th, 2005, 11:54 AM
#6
Re: Creating db
You can create a database in PHP and set permissions on it, as long as you have loggied in as the root mysql user or as a user with priviledges to grant permissions on a database.
Make sure that you have used mysql_select_db('MySql') before executing this query using the mysql_query() function.
Code:
GRANT ALL ON dbname.* TO 'username'@'hostname' IDENTIFIED BY 'password';
-
May 12th, 2005, 12:30 PM
#7
Re: Creating db
Thats interesting to know, thanks for the correction visualAd 
Cheers,
RyanJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|