So, I have a script I'm writing to help do some database management for times I can't get into phpmyadmin.
I am having problems with adding a database.
I took out that part of my script and created a small php file that looks like this.
<?php
mysql_connect("localhost","user","dbpass");
mysql_query("CREATE DATABASE cpnlname_dbname") or die (mysql_error());
echo "Your database should be created now.";
?>
Where dbuser is the username I use and dbpass is my password.
cpnlname_dbname I substitue in the name of the database I want to create.
When I try, I get the following error
Error creating database: Access denied for user: 'user@localhost' to database 'cpnlname_dbname'
However, if I use the name of a database that had existed at one point, but doesn't now. It works with no problems and creates the database.
But, when I try a database name that never existed, it gives the above error message.
I can use the same user and password to get into myphpadmin and create the database that way. So I know I am using the correct username and password.
Any help at all would be great.
Its the last part of my php code that is driving me nuts, because it should work.