Est. 2003
Home Help Login Register
News: Welcome to ZboX Webhosting.
10 Megs

10 MB Disk
1 GB Transfer
$10.00 per year
25 Megs

25 MB Disk
2 GB Transfer
$25.00 per year
50 Megs

50 MB Disk
3 GB Transfer
$50.00 per year
75 Megs

75 MB Disk
4 GB Transfer
$75.00 per year
500 Megs

500 MB Disk
10 GB Trans
$100.00 yr.

+  ZboX Webhosting Est. 2003. Now in our Fifth year!
|-+  Help!
| |-+  Problems and/or Questions
| | |-+  Database creation question
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Database creation question  (Read 177 times)
DJ Mike
Serious Poster
****
Offline Offline

Posts: 166



Database creation question
« on: September 29, 2008, 04:36:11 PM »

When I try to create a database with a PHP script...

Code:
<?php
$sql 
"CREATE DATABASE dbname";
$new_db mysql_query$sql$connection );
?>

... nothing happens, not even a even an error message. I can create a DB with cPanel though. Is this some kind of permission issue? Whem I use cPanel, it appends my user name toy the database name.
Logged


DJ Mike
Serious Poster
****
Offline Offline

Posts: 166



Re: Database creation question
« Reply #1 on: September 29, 2008, 05:10:43 PM »

I used the following code to see what my privileges are...

Code:
<?php
$sql 
"SHOW GRANTS FOR djmike@localhost";
$perms mysql_query$sql$connection );
while (
$row mysql_fetch_array($perms) )
 { 
$data[] = $row; }
echo 
"<pre>";
print_r($data);
echo 
"</pre>";
?>

... and it said I have all privileges on all existing databases but it doesn't look like I have super user priviledges to create databases. When I use cPanel, I do have super user priviledges.
Logged


ZboX
Founder
Administrator
Posting Maniac
*****
Offline Offline

Posts: 1660


What 'ya got there??


Re: Database creation question
« Reply #2 on: September 29, 2008, 05:34:03 PM »

I used the following code to see what my privileges are...

Code:
<?php
$sql 
"SHOW GRANTS FOR djmike@localhost";
$perms mysql_query$sql$connection );
while (
$row mysql_fetch_array($perms) )
 { 
$data[] = $row; }
echo 
"<pre>";
print_r($data);
echo 
"</pre>";
?>

... and it said I have all privileges on all existing databases but it doesn't look like I have super user priviledges to create databases. When I use cPanel, I do have super user priviledges.

Actually Mike no one has super user privileges. You can not use a script to create a DB. Reason being is security. Cpanel allows you to create a DB under YOUR username. No one elses. (with super user you would be able to do that.) If you think about it, allowing just scripts themselves to create the DB could be a really bad thing. You must create the database for any script you want to use first before installing the script, EXCEPT for the scripts in Cpanel's "Fantastico". Fantastico will allow you to create the DB as you install the script. But, Fantastico is tied to your user so that's why it's able to do that.

~;-)

Bert
Logged

Homepage / Community: http://zboxhosting.com

Contact: sales@zboxhosting.com
"Ohhh weeeeeee ohhhh, weeeee ohhhhhh wa. Ohhhh weeeee ohhhhh, weeeee ohhhhh wa!"
DJ Mike
Serious Poster
****
Offline Offline

Posts: 166



Re: Database creation question
« Reply #3 on: September 29, 2008, 06:27:32 PM »

It suds like you are saying that cPanel and Fantastico are super users.

Also seems like lame security to me. cPanel uses the same username/password that a script would need so if someone already had them for a script, they'ld also have access to cPanel. Not only that, you don't need a script to create a DB, all you need is a form with the right cPanel URL as an action. It wouldn't work if you were not logged in to cPanel but a script wouldn't work without the same username/password.
Logged


ZboX
Founder
Administrator
Posting Maniac
*****
Offline Offline

Posts: 1660


What 'ya got there??


Re: Database creation question
« Reply #4 on: September 30, 2008, 05:21:53 PM »

Quote
Also seems like lame security to me. cPanel uses the same username/password that a script would need so if someone already had them for a script, they'ld also have access to cPanel. Not only that, you don't need a script to create a DB, all you need is a form with the right cPanel URL as an action. It wouldn't work if you were not logged in to cPanel but a script wouldn't work without the same username/password.

Mike,
Cpanel uses the individual accounts username and password. Think about it. If Cpanel was super user then there wouldn't be a Cpanel as there'd be so many exploits they'd go out of business. Fantastico also uses the individual accounts username and password. The scripts Fantastico uses are jailed to each account that requests the scripts. That's why Fantastico can create the DB's needed on it's own.

~;-)

Bert
Logged

Homepage / Community: http://zboxhosting.com

Contact: sales@zboxhosting.com
"Ohhh weeeeeee ohhhh, weeeee ohhhhhh wa. Ohhhh weeeee ohhhhh, weeeee ohhhhh wa!"
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

ZboX Webhosting Est. 2003. Now in our Fifth year! | Powered by SMF 1.0.10.
© 2005, Simple Machines LLC. All Rights Reserved.
Page created in 0.094 seconds with 20 queries.