Go Back   HostGator Peer Support Forums > Public Forums > Suggestions

Notices

Reply
 
Thread Tools
  #1  
Old 01-14-2009, 02:24 PM
kahiro kahiro is offline
Hatchling Croc
 
Join Date: Dec 2008
Posts: 2
Default Create Database with PHP script.

I don't see a forum for questions, so I will post it here: Is there a way to create a database directly from a php script. When I try do it I get an error saying that I don't have permissions, I can't do it with phpMyAdmin neither. So I have to do it manually using the MySQL Database Wizard.

Any suggestions will be much appreciated.

Reply With Quote
  #2  
Old 01-14-2009, 03:47 PM
kahiro kahiro is offline
Hatchling Croc
 
Join Date: Dec 2008
Posts: 2
Default Re: Create Database with PHP script.

Is not possible to do this, or is it and am I missing something here?
Reply With Quote
  #3  
Old 01-14-2009, 04:08 PM
BrianH's Avatar
BrianH BrianH is offline
Junior Croc
 
Join Date: May 2006
Posts: 198
Default Re: Create Database with PHP script.

Are you on a shared server? My understanding is that if you are on a shared server, then you have to use the MySQL Database Wizard or MySQL Databases page to create/delete SQL databases and create/delete SQL database users. You can, however, still use phpMyAdmin for database operations. I don't know about creating a database directly from a php script.
Reply With Quote
  #4  
Old 01-14-2009, 05:44 PM
chr1831 chr1831 is offline
Baby Croc
 
Join Date: Mar 2008
Location: Los Angeles, California
Posts: 99
Default Re: Create Database with PHP script.

It can very well be done (but if you are going to do this for subselling reasons that is a violation of the tos (terms of service). Please look into using the cpanel api http://tinyurl.com/8svykg good luck =)

-Chris
Reply With Quote
  #5  
Old 02-06-2009, 11:11 PM
GatorThomas
HostGator Guest
 
Posts: n/a
Default Re: Create Database with PHP script.

You can do it through your PHP code as long as you use the MySQL username and password assigned to the database you wish to drop, and you have given ALL permissions in cPanel to that user for the database.

Code:
root@test [/home/test/]# mysql -utest_test -pq1w2e3r4 test_test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 80296
Server version: 5.0.67-community MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> drop database test_test;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)

mysql> \q
Bye
As was stated above, if you are reselling on a shared account, you are violating ToS and your account can be terminated without warning.

DISCLAIMER: Server name, username and password have been modified to protect the account.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a image like this ghpk Off-Topic 5 07-16-2007 05:50 PM
Job board script and SQL Database jasonec Webhosting 3 09-26-2006 11:54 PM

All times are GMT -5. The time now is 12:59 PM.