Yes mysql_connect () can sniff. The password is "scrambled" , but this will not stop the attacker. All requests are transmitted via wire in plain text, and an authenticated session can be captured if you sniff TCP sequence identifiers.
You should use full transport layer encryption, which is possible using the MYSQL_CLIENT_SSL flag if you are concerned about this attack. If you are establishing a mysql connection over the Internet or otherwise an untrusted network, this is necessary. This is not necessary if you are connecting through localhost.
source share