Page 1 of 1

Unable to connect to mysql

Posted: Tue Jun 29, 2010 12:25 pm
by Ratzzak
I'm trying to connect to mysql from php.
But i'm unable to connect.
I'm getting all these errors instead..

Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Fatal error: Maximum execution time of 30 seconds exceeded in F:\Program Files\Apache2.2\htdocs\index.php on line 8


Apache and PHP are working fine.
Problem occurs only when i try to connect to mysql.
I have enabled the mysql extension in php.ini file

Thanx
Ratzzak

Re: Unable to connect to mysql

Posted: Tue Jun 29, 2010 12:40 pm
by Ratzzak
I have been using wamp till date and now have done separate installations..
Stuck badly.. need some help..

Re: Unable to connect to mysql

Posted: Tue Jun 29, 2010 7:33 pm
by Jade
You need to do this before you connect to your database: http://php.net/manual/en/function.date- ... ne-set.php

Re: Unable to connect to mysql

Posted: Tue Jun 29, 2010 8:11 pm
by Ratzzak
I still get this error

Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in F:\Program Files\Apache2.2\htdocs\index.php on line 8 Fatal error: Maximum execution time of 30 seconds exceeded in F:\Program Files\Apache2.2\htdocs\index.php on line 8

Re: Unable to connect to mysql

Posted: Tue Jun 29, 2010 9:20 pm
by Jade
It sounds like MySQL isn't running on that machine. Are you sure it's turned on?

Re: Unable to connect to mysql

Posted: Wed Jun 30, 2010 12:36 am
by Ratzzak
I'm able to access it via command prompt and also db-visualizer is working fine.

Re: Unable to connect to mysql

Posted: Wed Jun 30, 2010 7:23 am
by Jade
Do you have permissions to use the socket? What happens if you open a browser and type in http://localhost ?