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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.