Now my problem is that I can
not connect to MySQL databases throught PHP and the error maesage is: Can connect through socket...
Is MySQL configured to accept connections?
If not - it would refuse the connection attempt from php resulting in the error you gave.
Also - does phpinfo() show MySQL support?
Finally - your MySQL version has to match what the php module was linked against - IE if you are running MySQL 4 but php was linked against MySQL 3 you will have problems.