zubrag.com
Free php and cpanel scripts to automate your daily routine

Free PHP Scripts :: cPanel Database Creator

cPanel does not allow you to create databases directly from MySQL/PhpMyAdmin on cPanel webhosting. You would have to login to cPanel and use its interface to create database each time you need a new one.
cPanel Database Creator will make this process much easier. In order to create a database on your hosting server you just need to run this script from browser, shell, or cron job, passing database name as parameter.

Before using this script you will need to update it with cPanel username, password, and host name (domain or IP).

Usage: cpanel_create_db.php?db=database-name&user=username&pass=password
where database-name should be replaced with a database name to be created on your hosting server.
Database Creator will also create a database user and assign it to the database with ALL permissions. Script will not create database user if you omit the user parameter. In this case usage would be cpanel_create_db.php?db=database-name

Note: if script does not work try running it via cURL. This requires cURL installation on the server. Default cURL path is set to /usr/bin/curl. Feel free to change it in the script code if cURL path is different on your hosting server.

Download cPanel Database Creator


Comments

Peter July 16, 2006
Cool script!

Thanks
October 4, 2006
pretty
mrprez [anti-spam] gmail.com October 27, 2006
How do you create the user and grant priveleges?
October 30, 2006
Does not work pity
November 12, 2006
Second, that... does not work.
November 12, 2006
Sorry! It does work... I cant spell my own domain name. However its not much use if you cant assign users to the db
zubrag November 13, 2006
As stated above it will not work if cURL is not installed. We'll change it to work without cURL soon. Please post your requests on the forum, so we could discuss and fix. This page is not a good place for discussion. Thank you!

http://www.zubrag.com/forum/
justin November 27, 2006
well, i would go to the forum to talk about it, but no threads there about it. already looked. please let me know when you will have a version that doesnt require cURL, and that will work on any other host that is cpanel or not. thanks
delacreation [anti-spam] delacreation.com December 10, 2006
Please i need hepl!!!
i can not access to mysql Db
December 23, 2006
VERY cool script. Thanks!!!!!!!
reece December 27, 2006
i had a problem with not being able to create databases with cpanel and this workd perfectly

Thanks
April 26, 2007
when i create database it's work but
assign user to database is NOT WORKING

Thanks
poonam April 30, 2007
thanks....this script allows me to create database but...script dont assign user to new created database...please help ...its urgent.
networkofemail.com July 13, 2007
We have a ton of domains and it's a real pain always logging in to various domains to create databases. Especially if each domain needs the same script instealled and we have to create databases for them all.

Instead of hard-typing the domain name and password in to the file, you should make it so that you can specify the domain name and the cpanel password on the fly for the particular domain domain you're about to work with. After that, you specify the database name, user name and password for the domain you're working with.

You should do the same with all of your scripts, particularly e-mail account creator and forwarder, which I'm glad we found.

Thanks for your work!
wangfeel July 22, 2007
escapeshellarg made changes on $db_name, that's why you cannot assign the user to db, keep the original $db_name, you will get your result.
Share views with me by wangfeel at gmail dot com
August 21, 2007
the script only creates the user the first time i run it, if i reload the page it then creates the database and adds the user to it. cant figure out the issue.
vitormsousa [anti-spam] gmail.com October 27, 2007
very nice script!!! itīs very interesting.
cmstom [anti-spam] gmail.com November 28, 2007
Warning: exec() has been disabled

and host do not want to enable it. What can we do ?
gregory December 29, 2007
yes, i had the same issue as wangfeel the escapeshellarg() was adding html escaped quotes around my database name so the user wasn't getting added to an actual existing database. Other than this issue, this script works great! thanks for writing
March 6, 2008
Yea the escapeshellarg() is preventing the user from being added. This is an awesome script and I am very greatful
emekingsley [anti-spam] yahoo.com March 18, 2008
Thanks man
miketee July 2, 2008
Had some little issues with the script on my server. As mentioned above, the escapeshellarg() function in line 49 screws up the database name, adding single quotes to it. Eg database domain_wtf becomes domain_'wtf'.

To anyone interested, I have provided an update to the cpanel_create_db.php script here: http://www.mediafire.com/?ku7m11ej0jd
bullbutter [anti-spam] gmail.com July 28, 2008
thanks miketee, your version works wonders on my server. thanks
ankitpratap2005 [anti-spam] yahoo.com August 29, 2008
I got the script that I require.and it is working perfectly
class servers September 17, 2008
thanks - great script.

classservers.com
mihai1302 [anti-spam] yahoo.com September 23, 2008
It works perfectly.
bunda1302 [anti-spam] yahoo.com September 28, 2008
Mihai is correct, it works perfectly!!!
jigu March 19, 2009
hello
fritzroy15 [anti-spam] yahoo.com April 17, 2009
17 April 2009: For any 404 errors: On line 52, where you have http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/adddb.html?db=$db_name, there is no file named adddb.html, only addb.html, so in case you're getting a 404 not found, this is why.
Simply delete one 'd' so you are left with
http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/addb.html?db=$db_name
drew [anti-spam] buzzybeemarketing.com September 5, 2009
I found the problem. There is an extra d in the adddb.html path. The correct path is addb.html (only two d's)
jr2delgado [anti-spam] yahoo.com September 9, 2009
Sory but http://www.zubrag.com/downloads/cpanel_create_db.zip

down load link do not work
Viery November 5, 2009
The script is not assigning user to the created database. Please help. How do I fix this.
Nik January 5, 2010
This doesn't create database, only user.
Can you fix it please.

Add Comment

!!! Comments posted here will not be answered. If you want to ask a question please post it on the forum.

E-mail or Name: Not required. Email will be protected from spammers

Comment: Please do not post unrelated comments

Anti-spam: Please enter (51341aae) into the box