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 28, 2006
How do you create the user and grant priveleges?
October 31, 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 28, 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 11, 2006
Please i need hepl!!!
i can not access to mysql Db
December 24, 2006
VERY cool script. Thanks!!!!!!!
reece December 28, 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 14, 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 28, 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 7, 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 19, 2008
Thanks man

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 (6f1a3a9d) into the box