Jump to content

Privileges And Creating Database.


UberPooner
 Share

Recommended Posts

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

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.

Edited by boen_robot
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...