mySQL users problem

General help with installation, scripts, etc....

mySQL users problem

Postby dash34 » Tue Apr 30, 2013 11:38 pm

I created a mySQL database and created a user for the database. I successfully imported the definitions for the database from my development environment. When I try to connect to the database in php using the username and password for the user I created, I get an access denied error.

Here is the php code:

$db = mysql_connect("localhost","dash34_test","xxxxxx"); // I have replaced the real password with xxxxxx
if (!$db)
die('Could not connect: ' . mysql_error());
$result = mysql_select_db("dash34_gradebook",$db) or die("A MySQL error has occurred.<br />" );

Note that when I substitute my cPanel username and password for the one I created for the database, I can connect with no problems.

Sorry if this is a stupid noob question, but I think I've followed the instructions correctly. I would normally stop and restart the mySQL service when I did a change like this in my development environment, but of course you can't do that in cPanel - or can you?

I would post a picture of the cPanel page showing the user as having been created and added to the database, but oddly enough cPanel is down due to the server running out of disk space! Strange....
Posts: 2
Joined: Tue Apr 30, 2013 11:25 pm

Return to General Help

Who is online

Users browsing this forum: No registered users and 1 guest