Page 1 of 1

Creating Database permison

Posted: Tue Dec 19, 2006 12:19 pm
by reecec
Hi,

I wonder if someone could help

i have a php script to make a database, but the error is that the user im connected as does not have persmison to access this database im trying to create but you have to asign users to a database in cpanel. so how can you create a database if the user is denied.


thanks reece

Posted: Tue Dec 19, 2006 12:47 pm
by feyd
You create the database in CPanel most often.

Posted: Tue Dec 19, 2006 12:55 pm
by John Cartwright
you can create user with ALL PRIVELEDGES in cpanel as well.

Posted: Tue Dec 19, 2006 12:59 pm
by reecec
thanks, but the user does have full priveleges but only when you asign users to a database. so how can you create a database when loged in as a user that isnt yet set up for this database.

also yes i can do it in cpanel but i need it to be in the script

Posted: Tue Dec 19, 2006 1:01 pm
by John Cartwright
reecec wrote:thanks, but the user does have full priveleges but only when you asign users to a database. so how can you create a database when loged in as a user that isnt yet set up for this database.

also yes i can do it in cpanel but i need it to be in the script
So you want to do an action that a user does not have priviledges to? impossible.

Posted: Tue Dec 19, 2006 1:43 pm
by reecec
thanks yes so it seems i thought the same


how can a user create a database in php if you have to asign the users in cpanel to the database after its created.

how does cpanel let you create a database and then select users to it. in php you have to create database when loged in as a user

Posted: Tue Dec 19, 2006 2:03 pm
by feyd
CPanel has a user that has more privileges than the users you are assigning access to for that database.

Posted: Tue Dec 19, 2006 2:07 pm
by RobertGonzalez
This sounds like a hosted account that likes to charge for extra databases. They typically take away your right to create databases because it takes revenue away from them.

If you have the right to make more databases in your account, or if you have root level privilege to your database server (doubtful on shared accounts) I would say just change your user's permission in phpMyAdmin or even at the CLI. but that would require you having sufficient privileges (under your logged in account) to GRANT permissions.

Posted: Fri Dec 22, 2006 10:14 am
by reecec
Everah wrote:This sounds like a hosted account that likes to charge for extra databases. They typically take away your right to create databases because it takes revenue away from them.

If you have the right to make more databases in your account, or if you have root level privilege to your database server (doubtful on shared accounts) I would say just change your user's permission in phpMyAdmin or even at the CLI. but that would require you having sufficient privileges (under your logged in account) to GRANT permissions.

the last part from what everah said is true so would i be right in saying this:

When your on cpanel and you create a database that is on there server so basicly root access but when im loged in as a user using php i havent got priveleges per user to create a database. i would need a server with root access.

but im sure many scripts need to create databases

Posted: Tue Dec 26, 2006 8:08 am
by feyd
No, many scripts do not need to create a database. Use an existing one, sure, but few, if any, need to create a database just for themselves.

Posted: Thu Dec 28, 2006 10:19 am
by reecec
Hi, hope you all had a good xmas

i found out you cant make databases in php when your hosting has cpanel so i have used cUrl to create it in cpanel through php

thanks reece

Posted: Thu Dec 28, 2006 11:02 am
by RobertGonzalez
reecec wrote:Hi, hope you all had a good xmas

i found out you cant make databases in php when your hosting has cpanel so i have used cUrl to create it in cpanel through php

thanks reece
cPanel should have nothing to do with your ability to make a database. That permission should be at the database level. I think.

How were you able to do it with cURL?

Posted: Thu Dec 28, 2006 11:10 am
by feyd
Is there a reason behind needing to create these databases? I mean a real one; experimentation is legit.

I just think if you're building an application that needs new databases all the time (and dynamically created) that there's something wrong with the design on a grossly fundamental level.

Posted: Thu Dec 28, 2006 11:59 am
by reecec
everah, I have made it so it logs into cpanel and in the address it contains the db name

Code: Select all

$resultdata = exec("$curl_path 'http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/adddb.html?db=$db_name_data'");

it was from this website http://www.zubrag.com/scripts/cpanel-da ... reator.php

___

feyd, sorry but i dont think you can comment like that if you dont know the application im trying to create, the database is a one of creation in sign up they see and know noting about this.

thanks reece

Posted: Thu Dec 28, 2006 12:08 pm
by feyd
If you feel I can't comment, then please enlighten me/us on why your application needs to create databases.