Jump to content

Having trouble connecting to mysql database


mfoster

Recommended Posts

Server: Localhost via UNIX socket

Server version: 5.0.87-community

Protocol version: 10

User: fultonr1@localhost

MySQL charset: UTF-8 Unicode (utf8)

 

I've just moved a domain from one host to another.  The script worked fine at the former host.  The information on the new host is listed above.  I was successful at exporting the database and can work with it through the control panel.  However now I don't seem to be able to access the database from my php script. 

 

My new host says that it's a programming problem and can't help me. :-[

 

The code (which I copied from w3schools) includes some error analysis which I have included in the script.  That code also shows that the mysql_connect seems to be working and  is returning Resource Id1.

 

The mysql_select_db command seems to be the problem as it is throwing the following error message:

Access denied for user 'fultonr1_mfoster'@'localhost' to database 'fultonr1_entries'

 

You can access the script yourself at http://fulton68reunion.com/view2.php

 

 

I've checked the database name, username, and password and all seem to be correct.

 

$con = mysql_connect("localhost", "****", "****") ;
$db_selected = mysql_select_db("fultonr1_entries",$con);
if (!$db_selected)
  {
  die ("<br/> Can\'t use fultonr1_entries database : " . mysql_error());
  }

 

I/ve included a copy of the file.

Maybe it's just me, but if I were you I would edit that file and remove any username and password that you have shown in that file.  :shrug:

 

I wish I could help, and I try to look at the php file. Are you sure that you created the db in your MySQL? Is it listed?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.