Reply
Can't create database message.
Old 10-21-2004, 04:34 AM Can't create database message.
Novice Talker

Posts: 7
Helo guys,
I keep on getting the message :Can't create database ... Database exists.
I have root privilleges, and there is not definetely a database with the name I am trying to create.

Here is part of the code I am trying to run:
<?php
// Connect to MySQL, using the mysql_connect function.
mysql_connect ("localhost", "root", "") or die ("Could not connect to the database!");

// Create the database where the tables will be stored.
mysql_create_db ("MyMP3") or die (mysql_error ()) ;

// Select the database I want to work with.
mysql_select_db ("MyMP3") ;

// Create the mp3 table.
$mp3 = "CREATE TABLE mp3 (
mp3_id INT NOT NULL auto_increment ,
mp3_band VARCHAR ,
mp3_track VARCHAR ,
mp3_type TYNIINT ,
mp3_year INT ,
mp3_duration DEC ,
mp3_file_size DEC ,
mp3_comments VARCHAR ,
PRIMARY KEY (mp3_id) ,

$results = mysql_query ($mp3) or die (mysql_error ()) ;

echo "MyMP3 Database has been created successfully!" ;
?>

Can you tell me why I get this error.

Thank you very much.
Artful Dodger is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 10-21-2004, 07:49 AM
KeithMcL's Avatar
Super Talker

Posts: 128
Location: Dublin, Ireland
Try putting the db name in all lowercase. If no joy, just use a different name
KeithMcL is offline
Reply With Quote
View Public Profile Visit KeithMcL's homepage!
 
Old 10-21-2004, 09:01 AM
Republikin's Avatar
Super Moderator

Posts: 3,191
The database already exists so it can't create it. Try selecting the database first, if it is there the query will return a boolean TRUE if not it will return FALSE. If it returns FALSE then use mysql_create_db()
Republikin is offline
Reply With Quote
View Public Profile
 
Old 10-22-2004, 10:12 AM
Novice Talker

Posts: 7
Thank you guys. Neither of the suggestions worked. I restarted the PC and run the code again. After the restart worked fine.
Thank you very much.
Artful Dodger is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can't create database message.
 

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12113 seconds with 13 queries