Page 1 of 1

Connection issue

Posted: Fri Jan 27, 2012 8:19 am
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.

Re: Connection issue

Posted: Fri Jan 27, 2012 12:01 pm
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');

?>

Re: Connection issue

Posted: Fri Jan 27, 2012 1:07 pm
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.