eduard Posted February 15, 2011 Share Posted February 15, 2011 I don´t understand!Code:<html><body><?php$con = mysql_connect ("localhost","eduard");if (!$con){die ('Could not connect: ' . mysql_error());}if (mysql_query ("CREATE DATABASE my_db",$con) ){echo "Database created";}else{echo "Error creating database: " . mysql_error();}mysql_close($con);?></body></html>How can I have a database (My_db)? Link to comment Share on other sites More sharing options...
thescientist Posted February 15, 2011 Share Posted February 15, 2011 I'm just gonna go out on a limb and request a merge here. http://w3schools.invisionzone.com/index.php?showtopic=36410(merged with the other cited thread in that link)seriously, just stick to one thread, its the same darn question/topic.I guess the first question is, is do you see any of error messages? If so, then you have a problem. Which kind of error message you get would be your clue to where to start debugging.edit: you may need to supply a password. It all depends on if the connection goes through or not. Link to comment Share on other sites More sharing options...
eduard Posted February 15, 2011 Author Share Posted February 15, 2011 I don´t understand: a database must be selected before you create one! How can I select a database when this is my first one? Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2011 Share Posted February 15, 2011 That's what the "CREATE DATABASE my_db" part does... it creates a database. If you've seen the message "Database created", then... well... the database is created. From that point on, you can work with it.[edit]Well... it's a slightly different question than the linked one... it seems as if the connection is successful now... but yeah, I'll keep the merging idea in mind[/edit] Link to comment Share on other sites More sharing options...
thescientist Posted February 15, 2011 Share Posted February 15, 2011 wtf!?why don't you just participate in the thread you JUST made about creating a database (or the multiple other ones....) :)just so you know, you can create a datase using phpMyAdmin, buy typing this into your address bar (assuming everything you need is running) http://localhost:8888/phpMyAdmin/ you may or may not need the port number. Link to comment Share on other sites More sharing options...
eduard Posted February 15, 2011 Author Share Posted February 15, 2011 I'm just gonna go out on a limb and request a merge here. http://w3schools.invisionzone.com/index.php?showtopic=36410(merged with the other cited thread in that link)seriously, just stick to one thread, its the same darn question/topic.I guess the first question is, is do you see any of those error messages?edit: you may need to supply a password. It all depends on if the connection goes through or not.Thanks! My database has the extinction .php or .mysql? Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2011 Share Posted February 15, 2011 My database has the extinction .php or .mysql? Neither. The MySQL database server is a separate program (included in MAMP) that keeps your data in its own format. It's NOT a file you open and edit. It's a system you interact with. To interact with it, you use a language called "SQL". Different graphical programs also use the SQL language "under the hood" but they let you click on buttons and stuff instead of typing SQL.<< Topic merged >> Link to comment Share on other sites More sharing options...
eduard Posted February 15, 2011 Author Share Posted February 15, 2011 I'm just gonna go out on a limb and request a merge here. http://w3schools.invisionzone.com/index.php?showtopic=36410(merged with the other cited thread in that link)seriously, just stick to one thread, its the same darn question/topic.I guess the first question is, is do you see any of error messages? If so, then you have a problem. Which kind of error message you get would be your clue to where to start debugging.edit: you may need to supply a password. It all depends on if the connection goes through or not.When I type: http://localhost:80/phpAdministrator/ > ´File not found´ Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2011 Share Posted February 15, 2011 See thescientist's post again. It's http://localhost:8888/phpMyAdmin/ That's nothing like what you've tried. Link to comment Share on other sites More sharing options...
eduard Posted February 15, 2011 Author Share Posted February 15, 2011 I have have an error:Access denied for user"@"localhost to 'my_db'What does that mean? Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2011 Share Posted February 15, 2011 << Another topic merged >>Will you stop creating new topics for goodness' sake?!?! :)The message means one of several things:1. The username is not correct.2. The password is not correct.3. The specified database does not exist.4. The specified username and password are valid, and the database exists, but the database is configured not to allow the specified user.IMPORANT:By default, to connect to MySQL, you need to type "root" as the username, without a password. Link to comment Share on other sites More sharing options...
thescientist Posted February 15, 2011 Share Posted February 15, 2011 if all this was in one thread, you may have already found your answer.... edit: you may need to supply a password.I'll say it again, read the documentation.http://www.mamp.info/en/documentation/faq.html Link to comment Share on other sites More sharing options...
eduard Posted February 15, 2011 Author Share Posted February 15, 2011 if all this was in one thread, you may have already found your answer....:)I'll say it again, read the documentation.http://www.mamp.info/en/documentation/faq.html All about MySQL is clear, but I don´t understand why I have an error! Link to comment Share on other sites More sharing options...
thescientist Posted February 15, 2011 Share Posted February 15, 2011 ... Link to comment Share on other sites More sharing options...
ShadowMage Posted February 15, 2011 Share Posted February 15, 2011 I don´t understand why I have an error!Then maybe you should start reading the responses you get. :)Boen_robot gave you the answer:The message means one of several things:1. The username is not correct.2. The password is not correct.3. The specified database does not exist.4. The specified username and password are valid, and the database exists, but the database is configured not to allow the specified user.IMPORANT:By default, to connect to MySQL, you need to type "root" as the username, without a password. Link to comment Share on other sites More sharing options...
eduard Posted February 16, 2011 Author Share Posted February 16, 2011 When I type: http://localhost:80/phpAdministrator/ > ´File not found´I solved that problem yesterday! An answer, please? Link to comment Share on other sites More sharing options...
thescientist Posted February 16, 2011 Share Posted February 16, 2011 I solved that problem yesterday! An answer, please?to what? Link to comment Share on other sites More sharing options...
Fmdpa Posted February 16, 2011 Share Posted February 16, 2011 See thescientist's post again. It'shttp://localhost:8888/phpMyAdmin/ That's nothing like what you've tried. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.