Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Can not establish database connection
Old 09-12-2011, 07:53 AM Can not establish database connection
Burnsie's Avatar
Skilled Talker

Posts: 81
Trades: 0
Hi all
I have just upgraded PHP from 5.2 to 5.3 on my local machine, which is running XP Pro, IIS 5.1 and MySQL 5.something. This took me four days (honest) but does now work.
However, this has thrown up another problem, which I just can’t resolve despite another three days of trying!
I have a site that utilizes a small but nice PHP gallery called Plogger. This worked fine until I did the PHP upgrade. Now I find that I can not log on to the gallery. When I try to using the exact same login details that used to work I get these error messages:

•Cannot connect to MySQL with the information provided. MySQL error: Access denied for user 'root'@'localhost' (using password: YES)
•Cannot find the database MyDatabase. MySQL error: Access denied for user ''@'localhost' (using password: NO).

So I spent the last three days trying without success to establish a connection. I must have looked at every page out there in web land that even mentions these error messages but alas to no avail! I just can’t login.

I have built the site using Dreamwaver so I can view all the files and can even connect to the database via Dreamweaver!

As I have spent a week trying to perform something that should probably take less than an hour you can not imagine how grateful I would be for any help that you can give me.

As always cheers in advance
Burnsie
Burnsie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-12-2011, 02:44 PM Re: Can not establish database connection
StartWaves's Avatar
Novice Talker

Posts: 6
Name: Owen Brunette
Location: New York
Trades: 0
Is your database user name intended to be root?

Were you running the application as a non root user previously and are now running it as root and getting root as a database user?

It looks like the database username is empty in the last error message. See the empty quotes before that @. Have you displayed the user name just before the database call to see if it is what you expect?

Is your server actually on the localhost?

5.3 has a replacement optional internal mysql library (mysqli) are you using it and having some resulting issue?

What mysql version is your database server running?

Is the password abnormally long? You might want to try a shorter password. I can't see the limit defined but I did have a problem with password and user name length once.
__________________

Please login or register to view this content. Registration is FREE
, Project and Build Delivery.
Technology:
Please login or register to view this content. Registration is FREE
| Startups:
Please login or register to view this content. Registration is FREE
| Design:
Please login or register to view this content. Registration is FREE

Last edited by StartWaves; 09-12-2011 at 03:27 PM..
StartWaves is offline
Reply With Quote
View Public Profile Visit StartWaves's homepage!
 
Old 09-12-2011, 08:31 PM Re: Can not establish database connection
Burnsie's Avatar
Skilled Talker

Posts: 81
Trades: 0
Err
Perhaps I should have mentioned that I know next to nothing about PHP and mysql server, although my week’s worth of trawling the web for answers has given me the tiniest insight into these things. You have made my mind boggle with all your requests for info but here goes (I am not being flippant I am honestly clueless and really appreciate any help). I will answer them in order:

I don’t think so

I think so

Nope sorry this one is beyond me

I think so

I don’t know

I don’t think so

Yes I really am that clueless. All I know is that it used to work but following the PHP upgrade and nothing else now it doesn’t.

I really appreciate the help but as you can see I need a lot of it. Ho Hum
Burnsie is offline
Reply With Quote
View Public Profile
 
Old 09-12-2011, 10:46 PM Re: Can not establish database connection
StartWaves's Avatar
Novice Talker

Posts: 6
Name: Owen Brunette
Location: New York
Trades: 0
Some things to try:

Try logging into the database using the mysql command with the user name and password that you have setup on the database. Confirm which user name and password are being used. It's possible that the wrong database username is being used based on your reply and what is posted.

If you aren't running the application in the same way as before as your second answer implies then do try to run it in the same context as it was run before. If it previously ran from a web server then run it from the server. The server probably ran the code under a specific account rather than as root as it seems to be running now.

If you aren't able to find something then it sounds like it might be difficult for you to provide enough information for somebody else to diagnose the issue. Somebody is going to have spend some time working with or for you on this. You are probably going to need to pay for somebody to help you out unless you have a suitably skilled and generous friend with the time.
__________________

Please login or register to view this content. Registration is FREE
, Project and Build Delivery.
Technology:
Please login or register to view this content. Registration is FREE
| Startups:
Please login or register to view this content. Registration is FREE
| Design:
Please login or register to view this content. Registration is FREE
StartWaves is offline
Reply With Quote
View Public Profile Visit StartWaves's homepage!
 
Old 09-13-2011, 07:53 AM Re: Can not establish database connection
Burnsie's Avatar
Skilled Talker

Posts: 81
Trades: 0
hi
I put this code:

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>

into a.php file, (with 'admin', '1admin' and 'test' set to correct values) put it to my testing sever (localhost) and got this back:

Connected to MySQL
Connected to Database

so i know the database is still there and working, although I knew it was as i can see all that in Dreamweaver.

i can see the 'config.php' file, which isn't complicated and I can change that with gay abandon and it makes no difference I just can't login.
What ever I input for the gallery name, username and password I get the same two error messages at the same time. You can not leave the fields blank as you are prompted to enter the information, then it gives you the error messages.

I changed absolutely nothing after the PHP upgrade it just refuses to work. I have all the database configuration details written down on a piece of paper (as I’m thorough like that), they worked before, now they don’t.

Now i'm off to lie down in a darken room and rock myself to sleep!
(calm blue ocean, calm blue ocean)
Burnsie is offline
Reply With Quote
View Public Profile
 
Old 09-13-2011, 11:09 AM Re: Can not establish database connection
Burnsie's Avatar
Skilled Talker

Posts: 81
Trades: 0
IT LIVES!!!
I have finally got the thing to respond! My dancing has made the dog leave home!
I think I made a school boy error, there were to config files and I was editing the wrong one oops. However, how the info was altered by installing a newer version of PHP shall remain a mystery!! Oh who cares...it works, it works
Burnsie is offline
Reply With Quote
View Public Profile
 
Old 09-13-2011, 03:18 PM Re: Can not establish database connection
StartWaves's Avatar
Novice Talker

Posts: 6
Name: Owen Brunette
Location: New York
Trades: 0
Party On. Congratulations.
__________________

Please login or register to view this content. Registration is FREE
, Project and Build Delivery.
Technology:
Please login or register to view this content. Registration is FREE
| Startups:
Please login or register to view this content. Registration is FREE
| Design:
Please login or register to view this content. Registration is FREE
StartWaves is offline
Reply With Quote
View Public Profile Visit StartWaves's homepage!
 
Reply     « Reply to Can not establish database connection
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26595 seconds with 12 queries