Eidos Forums

Go Back   Eidos Forums > General Eidos Community Forums > Community Chat

Reply
 
Thread Tools Display Modes
  #1  
Old 12-15-2004, 05:28 AM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default Any PHP/MySQL wizards here?

If so, I'd like your help on an issue I'm having.

I installed PHP 4.3.3 along with MySQL 4.1 and Apache 2. I followed the installation instructions to the letter that were in my book (Sams "Teach Yourself PHP, MySQL, and Apache," though it probably doesn't help you to know that). I'm sure that I have them up and running, but when I try to connect to MySQL I get the darn message
Quote:
Warning: mysql_connect(): Access denied for user: 'admin@localhost' (Using password: YES) in C:\Program Files\Apache Group\Apache2\htdocs\mysqlconnect.php on line 2
I tried looking through the mysql website to find a solution, but I want something in plain English that I can understand. They said do such-and-such a command to fix so-and-so, and I haven't the slightest idea what they're talking about...

I know someone might have some idea as to what I can do. Besides throwing it all out the window or getting a new book that is....
Reply With Quote
  #2  
Old 12-15-2004, 09:54 AM
DjZ DjZ is offline
Gamer
 
Join Date: Jun 2002
Location: #eccr
Posts: 219
Default

to be honest i havent got a clue

i have installed php and mysql and apache but it was a combined and ready to go install package.

they only thing i can say is have you created a username and password? there is a tool in one of the folders to set this info up but i cant remember what it was called
Reply With Quote
  #3  
Old 12-15-2004, 04:16 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

Yup, done that. And I'm sure I'm puting in that exact user name and password when I try to connect.
Reply With Quote
  #4  
Old 12-15-2004, 05:00 PM
Jeffers's Avatar
Jeffers Jeffers is offline
Protagonist
 
Join Date: Dec 2001
Location: UK
Posts: 1,204
Default

Could you either post your PHP code or pm me your php code so that I can have a look and make sure your syntax is all ok.

Doesn't matter about including your username and password, just replace then with the words username and password if you wish.

The only other thing I can think of is, have you tried using the ip 127.0.0.1 as the ip address of the mysql server?

Jeffers
__________________
Wondering what ever happend to QA and where this Out Now, Patch Later culture came from!!!!
Reply With Quote
  #5  
Old 12-15-2004, 05:32 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

Quote:
<?php
$conn = mysql_connect("localhost", "user", "password");
echo $conn;
?>
I haven't messed with the IP because I don't know how I'd do that and I don't want to mess anything up too much. But if you can tell me step by step I'll give it a try.
Reply With Quote
  #6  
Old 12-16-2004, 01:11 PM
Jeffers's Avatar
Jeffers Jeffers is offline
Protagonist
 
Join Date: Dec 2001
Location: UK
Posts: 1,204
Default

Well to me that seems ok.

I'll test the code using my own setup and make sure.

To put in the ip address, simple replace localhost with 127.0.0.1

so your code would look like the following:

PHP Code:
<?php
$conn 
mysql_connect("127.0.0.1""user""password");
echo 
$conn;
?>
Jeffers
__________________
Wondering what ever happend to QA and where this Out Now, Patch Later culture came from!!!!
Reply With Quote
  #7  
Old 12-16-2004, 05:31 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

That didn't work either.
Reply With Quote
  #8  
Old 12-17-2004, 07:34 AM
Jeffers's Avatar
Jeffers Jeffers is offline
Protagonist
 
Join Date: Dec 2001
Location: UK
Posts: 1,204
Default

well my mySQL and Apache servers have messed up because I've changed the configurations so much to match the servers I was doing my coursework on I'll have to set them up again and just make minor changes.

I'll get back to you with is as soon as possible.

One final thing you could try just while I remember is to put:

PHP Code:
<?php
mysql_connect
("localhost""user""password") or die ("Error: Database Connection Failed"); 
?>
I'm just starting to wonder what the actual result you are supposed to get is?

Like I say, I'll get back to you when I get my setup sorted out again.

Jeffers
__________________
Wondering what ever happend to QA and where this Out Now, Patch Later culture came from!!!!
Reply With Quote
  #9  
Old 12-17-2004, 03:15 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

Okay, so I added that and now it shows the line "Error: Database Connection Failed" at the end of the original message. So there's some problem connecting obviously, but we still don't know what...

I know that if it works I'll get a simple message like this:
Quote:
Resource id #1
Reply With Quote
  #10  
Old 12-18-2004, 12:17 PM
Jeffers's Avatar
Jeffers Jeffers is offline
Protagonist
 
Join Date: Dec 2001
Location: UK
Posts: 1,204
Default

ok, well I've got apache and mysql setup again, just need to do apache now.

I wonder why it gives you that message if it's successful.

Will get back to you soon.

Jeffers
__________________
Wondering what ever happend to QA and where this Out Now, Patch Later culture came from!!!!
Reply With Quote
  #11  
Old 12-18-2004, 04:43 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

Alrighty, I'll just be waiting here. No rush—I have plenty else to do in my spare time.
Reply With Quote
  #12  
Old 12-18-2004, 05:37 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

I was looking on mysql.com a little more and I found that MySQL creates 2 users automatically under the username "root" that use no password. Therefore I can connect using one of those (tried it already and it works), but I still don't know why I can't use the username and password that I created using the mysqladmin.exe...

At least I can get a working connection now and I can keep going with my learning. Have to learn how to create and code a blog CMS so I don't have to keep updating the HTML files by hand. Bleck!
Reply With Quote
  #13  
Old 12-19-2004, 02:58 PM
Jeffers's Avatar
Jeffers Jeffers is offline
Protagonist
 
Join Date: Dec 2001
Location: UK
Posts: 1,204
Default

Well, mine did work, but did some research into the problem cos it was annoying me. Anyway, I found something in my manual (should have looked there first, sorry) and found this:

Quote:
Access denied for user error
If you attempt to run a MySQL client program to connect to a server running on the same machine, but get the error Access denied for user 'some-user'@'unknown' to database 'mysql', this means that MySQL cannot resolve your hostname properly. To fix this, you should create a file named `\windows\hosts' containing the following information:

127.0.0.1 localhost
Jeffers
__________________
Wondering what ever happend to QA and where this Out Now, Patch Later culture came from!!!!
Reply With Quote
  #14  
Old 12-19-2004, 09:13 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

Thanks. I'll try that and see what happens.
Reply With Quote
  #15  
Old 12-20-2004, 12:40 AM
L Croft L Croft is offline
Protagonist
 
Join Date: Jul 2002
Location: London, UK (F)
Posts: 1,425
Default

I just had a thought, it might not help but when i set a new username on my account it always adds _lydia (lydia being my log in name for the control panel) to the name, so if yours was doing that same that could be your problem.
Reply With Quote
  #16  
Old 12-21-2004, 03:16 PM
Jeffers's Avatar
Jeffers Jeffers is offline
Protagonist
 
Join Date: Dec 2001
Location: UK
Posts: 1,204
Default

I don't know whether you tried setting the host file or not. But I finally got my configuration working again and tried setting up a user which worked. Although I didn't use the winmysql thing supplied with mysql, I used the MySql Control Center, downloadable from here: http://www.mysql.com/downloads/mysqlcc.html , which is quite a nice tool to use and can also be used to connect to remote databases. There are other tools on the mysql site you can use.

Just thought I'd let you know anyway. Hope your php and mysql are going ok.

Jeffers
__________________
Wondering what ever happend to QA and where this Out Now, Patch Later culture came from!!!!
Reply With Quote
  #17  
Old 12-22-2004, 09:28 AM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

It's working now. Thanks again for the help.

Nice download, too.

Oh, and I found out I got a pretty bad book. I got past all the PHP stuff and started on the mysql commands. At the beginning of the section they said something like, "We are assuming you know how to execute queries for mysql." I was like No, I really don't... But I guess it doesn't take a genius to figure out, lol. And they don't fully explain things in the book, so thankfully I can look in the mysql manual (which I didn't know I had) and it seems to explain things thoroughly.

Last edited by Eddy Bones; 12-22-2004 at 09:31 AM.
Reply With Quote
  #18  
Old 12-22-2004, 10:35 AM
@m's Avatar
@m @m is offline
Immersion Killer
Eidos Moderator
 
Join Date: Sep 2001
Location: Belgium
Posts: 3,655
Lightbulb

One thing you might want to know should you ever need/want to set up another computer with apache etc.

There's a program around called Appserv which combines Apache/php/mysql in one easy to download and install package. It can also be of much use for people wanting to test some php website stuff on there own computer.

I'll leave you guys at it now
Reply With Quote
  #19  
Old 12-22-2004, 12:00 PM
Eddy Bones Eddy Bones is offline
Protagonist
 
Join Date: Jul 2002
Location: USA
Posts: 1,677
Default

Awesome! Thanks for the info.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -8. The time now is 01:21 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.