Connection issue

Post here if you need help with SQL.
Post Reply
JuiceYum
Posts: 18
Joined: Fri Jan 27, 2012 8:11 am

Connection issue

Post by JuiceYum »

For some reason when I try click on a file in my blog folder (I'm followinf your blog tutorial now) I get a HTTP Error 500. When I remove all the code within the PHP tags in init.inc.php it goes away and I can see like a test paragraph on the actual blog_list.php
Here is my PHP code in init.inc.php
<?php

mysql_connect('localhost', 'example_user', 'example_pass');
mysql_select_db('blog');

include('inc/posts.inc.php');
include('inc/comments.inc.php');

?>
Also I'm using MAMP on Mac OSX.
JuiceYum
Posts: 18
Joined: Fri Jan 27, 2012 8:11 am

Re: Connection issue

Post by JuiceYum »

All fixed but now I have another issue and thats in init.inc.php. Full error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'example_user'@'localhost' (using password: YES) in /Applications/MAMP/htdocs/blog/core/init.inc.php on line 3

My code in init.inc.php
<?php

mysql_connect('localhost', 'example_user', 'example_pass');
mysql_select_db('blog');

include('inc/posts.inc.php');
include('inc/comments.inc.php');

?>
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Connection issue

Post by Temor »

That's a "wrong password" error. The cause is most likely that your username and password is not example_user and example_pass. Jacek uses those in his tutorials because he set up a user named example_user with the password example_pass.

The default login is root with no password.
mysql_connect('localhost', 'root', '');
try this.
Post Reply