UberPooner Posted August 2, 2009 Share Posted August 2, 2009 Hi, I would just like to create a database on my server, that is all. This is the code I am using, direct cut and paste from w3schools create section. <?php$con = mysql_connect("localhost","mistersa","password");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);?> The error i get is:Error creating database: Access denied for user 'mistersa'@'localhost' to database 'my_db' After searching the error for a while I found out that changing user privileges could solve my problem, though I could not figure out how to do that. Hostmonster is my web hosting. I am using version 2.11.9 of phpmyadmin. On the home page of that, there is no link to change privileges. Though when i click the information_schema it shows a list of tables and one of them is called user_privileges and everything is set to no except for "TABLE_CATALOG" which is set to yes. Though I am not to sure how to change the values of the fields. What do I need to do to be able to create a database? -thanks Link to comment Share on other sites More sharing options...
boen_robot Posted August 2, 2009 Share Posted August 2, 2009 Use phpMyAdmin to create the database, or whatever other admin panel you have at hand. Creating a database is a big deal for most web hosts, so you're usually only allowed to do that by special means, and not by a single query in your own PHP files. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.