Jump to content

R_14_14

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

R_14_14's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks everyone for your help. In the end I solved the problem by uninstalling everything and re-installing using WAMP. much easier.....
  2. O and I have also run the following from the command line: CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'passwrd'; and changed the user to 'testuser' and password to 'passwrd' etc. in my PHP script to make absolutely sure I am using the right user, host and password - still get same error message.
  3. OK thanks for the suggestions so far. No luck though: I have run phpinfo(); there is indeed a MySQL section. I have attached the output that phpinfo gives, I know no-one is eager to trawl through it looking for the problem, but if anyone has an idea please do look at it, it would be a massive help! MySQL is indeed listening at port 3306; although I am just trying to connect to MySQL locally, from the same computer that has the database on it (eventually I just want to test a website that I am designing), so I dont know, does this still apply? Also I have tried to connect with my firewall completely turned off, just in case, but still get same error message. I couldn't find a mysql.err file in the MySQL installation directory, however I could find a mysqld_error.h file. It lists many errors, most of them I believe are due to me entering invalid syntax from the command line, when I was still playing around, but I have attached it in case it's useful. [attachment deleted by admin]
  4. I couldn't at first start the service from task manager, even though I have admin rights, etc., but I've now got MySQL running and can access it from command line. However, I still get the first error message when trying to connect via PHP. Any ideas what could be causing this? My PHP script is as follows: <?php $link = mysql_connect ('localhost', 'root', 'PASSWORD'); if (!$link) { die('Could not connect: ' . mysql_error()); } else { print 'successful'; } mysql_close($link); ?> The only thing I wasn't sure about was the username 'root', when installing MySQL it never asked me for a username. Could this or something else in the PHP script be the issue? or is there something wrong with the way I have set up PHP/MySQL/Apache?
  5. I know it's essentially the same problem as I posted in this thread, because I myself posted the other thread......... which you could have seen....... had you bothered to read it. The reason I started a new thread is because I started with severeral problems, most of which I have now eliminated, boiling it down to the core issue. These secondary problems (which were easily eliminated) would only confuse the reader, hence I started the new thread which deals only with the core issue at hand.
  6. Thanks for your replies. I have now tracked down the error further, seemed wise to start a new post: http://www.phpfreaks.com/forums/index.php/topic,311220.0.html
  7. Hi, I can't seem to connect to MySQL via PHP. I get the following error message when I try: Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 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 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 I am running windows 7 with Apache 2.2, PHP 5.3 and MySQL server 5.1. In task manager, ApacheMonitor is running under processes and Apache is running under services. MySQL is listed under services, but is stopped. When I try to access MySQL via the command line I get the following error message: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) So it would seem I have set up Apache/MySQL wrong. Could anyone please tell me what I should check for? P.S. when I first installed MySQL I could access it via the command line fine, but I still couldn't connect via PHP. Not being able to access it via command line is a recent development.
  8. and this is mysql heading from phpinfo(); : MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Directive Local Value Master Value mysql.allow_local_infile On On mysql.allow_persistent On On mysql.connect_timeout 60 60 mysql.default_host no value no value mysql.default_password no value no value mysql.default_port no value no value mysql.default_socket no value no value mysql.default_user no value no value mysql.max_links Unlimited Unlimited mysql.max_persistent Unlimited Unlimited mysql.trace_mode Off Off
  9. OK thanks so far. my script is now as follows: <?php $link = mysql_connect ('localhost', 'root', 'PASSWORD'); if (!$link) { die('Could not connect: ' . mysql_error()); } else { print 'successful'; } mysql_close($link); ?> When I run it, I get the following error message: 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 'Europe/Paris' for '2.0/DST' instead in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 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 'Europe/Paris' for '2.0/DST' instead in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 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 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 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 'Europe/Paris' for '2.0/DST' instead in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 I changed the php.ini file, so that error reporting is on and set to E_ALL, and the mysql_connect extension is enabled. Here is (hopefully) relevant info from phpinfo(); : apache2handeler: Hostname:Port LAPTOP.home:0 Apache Environment: HTTP_HOST localhost SystemRoot C:\Windows SERVER_NAME localhost DOCUMENT_ROOT C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs Core: (1st value is local value, 2nd=master) display_errors On On display_startup_errors Off Off doc_root no value no value docref_ext no value no value docref_root no value no value error_reporting 22527 22527 SMTP localhost localhost PHP variables: _SERVER["HTTP_HOST"] localhost _SERVER["SystemRoot"] C:\Windows _SERVER["SERVER_SOFTWARE"] Apache/2.2.16 (Win32) PHP/5.3.3 _SERVER["SERVER_NAME"] localhost _SERVER["DOCUMENT_ROOT"] C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs Could someone please tell me whats wrong? Cheers!
  10. Hi, I am having trouble connecting to mysql via PHP. I have the following PHP script called mysqlconnect.php: <?php $link = mysql_connect ('localhost','root', 'PASSWORD'); if (!$link) print unsuccessful; else print successful; mysql_close($link); ?> (where I substitute PASSWORD with the real root password) which I try to run by typing http://localhost/mysqlconnect.php into my web browser. However, the screen stays blank and (un)successful is not printed. I am running windows 7 with Apache 2.2, PHP 5.3 and MySQL server 5.1. mysqlconnect.php is in the htdocs folder of the Apache installation directory. As far as I can tell Apache and PHP are configured correctly, the famous helloword.php script works fine. Also, I can see in task manager that Apache and mysql are running. Also, when I access mysql from the command line, the password works fine. The only thing I´m not sure about is username ´root´ - when configuring MySQL it never asked me for a username. Could someone please explain what I´ve done wrong? Sorry if this is a stupid question, I´m new to this stuff. Thanks a lot! [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.