开发者

MySQL not connecting with PHP

开发者 https://www.devze.com 2023-04-12 04:59 出处:网络
I installed MySQL server and everything worked fine in command line. I worked connecting MySQL to my ASP.NET application and there is no problem at all. Bu开发者_如何学运维t when I try to connect MySQ

I installed MySQL server and everything worked fine in command line. I worked connecting MySQL to my ASP.NET application and there is no problem at all. Bu开发者_如何学运维t when I try to connect MySQL to PHP applications I am unable to connect. When I installed PHPMyAdmin I am getting error #2002 Connot log in to thie MySQL server

I browsed all the night for this error and none of Google's results helped me! :(

Anybody can you please tell me where the problem is at? I believe I must change my PHP.ini file settings in order to connect to MySQL. Anybody please help me.


There are a lot of things that can cause this type of issue. Did you make sure that you have added php-mysql drivers to your sever. Since you said your using ASP i will assume that you are using windows servers. Make sure that you also are allowing that user to connect via localhost or what ever ip the PHP is on.

In php there are to standered ways of connecting to a MySQL database.

  1. php-mysql(is going to be depercated soon).
  2. php-mysqli(OOP version of the php-mysql with lots of features).

With out one of these php will be unable to work with a MySQL database. I am not sure if phpmyadmin works with both drivers or just one of them It could be throwing a die("message") Just to let you know it is not working instead of throwing a more complex php error. You may want to see if you can incress error reporting.

You can check if your php installastion has the mysql driver by looking in your php.ini and also checking with.

phpinfo();


It is almost always about config. https://bbs.archlinux.org/viewtopic.php?id=90133

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号