Database related Q&A
1. FAQ: I can't connect to MySQL DB from the IDE. When I tried to connect to mysql it returns with Client does not support authentication protocol requested by server; consider upgrading MySQL client error box.
It means you have to replace libmysql.dll that comes with phped with one shipped with mysql database.
Starting with build 3397 PHPEd supports libmysql.dll version 4.x. But can not be distributed with it because of MysqL license.
2. FAQ: I can't connect to MySQL DB from my script
When I execute the mysql_connect istruction accur this error: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client
It means that you have to install appropriate mysql library and mysql for php extension. Without them you can't connect to mysql database server version 4 or higher as they use different authentication protocol.
BTW, new libmysql.dll is shipped with php5 and php4.
3. FAQ: I can't connect to MySQL, authentication error returned
Whenever I try to connect to database I get "incorrect password for username@yy.yy.yy.yy" error. I'm sure I specified correct passwrod for the username
If you specified password for a username using grant command and the username was set without a hostname or IP address, MySQL will grant rights to the user only for the address from which you were connected to the server.
If you do this in the server console, the address is localhost. After the user is created, you can try to connect to the same server from a different machine, but it will not work returning authentication error.
You have to either issue new grant commands for each client address or issue grant with % as a hostname. In latter case all addresses will be allowed.
For example
`grant all on mydbname.* to 'username'@'192.168.0.5' identified by 'some_pass'`
`grant all on mydbname.* to 'username'@'%' identified by 'some_pass'` For further details check adding-users topic in the mysql manual.
4. FAQ: I can't connect to MySQL (error 10061)
Whenever I try to connect to database I get "Can't conect to MYSQL server on xx.xx.xx.xx (10061)" error
Error 10061 means that one of the following problems takes place:
-no MySQL service is running on the port you selected for in mySQL settings or
-MySQL server is NOT running or
-MySQL is blocked by firewall either on your local machine or on the server or
-MySQL is bound to localhost while you're trying to connect to it using LAN/WAN IP address or hostname
- Make sure mysql service is running
- Make sure mysql is listening on TCP/3306 port and this port is selected for the DB account in PhpED.
- Make sure firewalls on your local machine and on the server permit connection to the service.
- Make sure mysql service is bound to the address that you're trying to reach it at
The following command will show you all listening sockets (and daemons PIDs) running on your computer.
netstat -naop TCP
For example an output like below ensures that the process 932 is listening on port 3306 and bound to 0.0.0.0 (meaning ALL) address:
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1560
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING 1768
TCP 0.0.0.0:1031 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 932
Then open Task Manager, enable PID column and see what process name corresponds to the PID (932 in my example).
|