Web :: General :: mysql error "could not connect to specified instance" in Apache 2 with PHP 5 |
|||
| By: Nono |
Date: 12/11/2006 10:11:40 |
Points: 20 | Status: Answered Quality : Excellent |
|
could not connect to specified instance mysqlerror number 0 please help.. i was able to test the apache and php as suggested in the documentation but mysql is not working for me... i am getting the same error when i start mysql administrator. i am using serverhost : localhost username: root password : the one i choose but when i login through command prompt i get the mysql prompt which i think is a good sign. any help with sql administrator. yes i did start mysql service. appreciate your help... When i start my apache and load the php page i don't see mysql in it... |
|||
| By: VGR | Date: 12/11/2006 10:20:17 | Type : Answer |
|
| I guess you mean that in phpinfo() results, you don't see the standard mysql section... That's normal for PHP5 0) given PHP5 does no longer come with built-in MySql support, checked in php.ini that you enabled the extension mysql. 1) check first that you don't have multiple php.ini files and that you edit the good one. 2) don't forget to restart the webserver after changing php.ini (in unix, you could reload config without restarting - that's apache -k I think) 3) you may try first to "fix" an incorrect extension_dir : add a trailing slash, as in extension_dir = "C:/PHP5/ext/" (forward or backslashes notwithstanding) 4) you probably need to copy the libmysql.dll to your %WINDIR% directory (in your case C:\WINDOWS as per phpinfo). Beware, some say "to %windir%\System32" maybe re-read the ***current*** install doc. 5) you should then see mysql in phpinfo() results - if not, presevere and check the errors that Apache is issuing at load time, probably an "unable to load extension at..." check pathes. 6) if it's ok, then other possible causes : -6a) you use a PHP enabled to use the standard MySql encryption scheme, so called OLD_PASSWORD() while your server is configured (use_old_passwords directive, I think) to use the old ones, or the reverse of course. As you seem to be able to get into mysql in the console, try SHOW DATABASES (you should see "test" and "mysql" databases), then USE mysql; and then :select Host, User,Password,Drop_priv from user; check that you've something like :
the length of the Password data will "tell" you the password scheme used. check the Mysql online manual for details about OLD_PASSWORD() you can try to reset the root password both on the console and in your scripts (to see if you can mysql_connect(), mysql_query() and such) : do a update user set Password=OLD_PASSWORD('yourpwd') where User='root' and Host="localhost'; flush privileges; exit; -6b) firewall blocking access from Apache to MySqld (while it lets pass through the console mysql program... unprobable) -6c) for an unknown reason, "localhost" does not resolve to 127.0.0.1 - try with '127.0.0.1' as a host when connecting from PHP 97) you may return to the good ol' PHP 4, as a lot of people did after hitting the "PHP5 won't install properly" wall , including me ;-) 98) you're not the only one to have this kind of problems. You may read - the same problem, but with IIS (sigh) - the very same problem - I'm against doing this, but you may look at the last comment on this help forum thread - check absolutely the alternative described in the last post of this 99) good luck :D |
|||
| By: OpConsole | Date: 03/01/2007 18:50:16 | Type : Comment |
|
| If the above comment was helpful, please close the Question appropriately ; if not, then provide some more feedback so that our Experts may help you. Thanks. |
|||
| By: Nono | Date: 24/01/2007 07:30:12 | Type : Comment |
|
| yes. the problem lies in fact at step 0) given PHP5 does no longer come with built-in MySql support the problem was the missing library (extension) for PHP5 / MySql 5 (not even using mysqli, just standard mysql API) the problem is apparently solved in PHP 5.0.x Installing the latest Apache 2.2 with latest PHP 5 just plain works ;-) thanks for the deep analysis |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








