If you face any problem to connect MySQL server,you use folowing steps to correct the problem:
First please make sure that the server is running and if it is not running, you cannot connect to it.
For example, if you are trying to connect to the server and see a message such as one of those following, one cause might be that the server is not running:
shell> mysql
ERROR 2003: Can't connect to MySQL server on 'host_name' (111)
shell> mysql
ERROR 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (111)
The server is running, but you cannot connect because you might be trying to connect using a TCP/IP port, named pipe, or Unix socket file different from the one on which the server is listening. you can correct this problem by checking when you invoke a client program, specify a --port option to indicate the proper port number, or a --socket option to indicate the proper named pipe or Unix socket file. You can easily find out where the socket file is, by using this command:
Access denied for user ''@'unknown' to database mysql
In this case, you will have to restart the server with the --skip-grant-tables option and edit your /etc/hosts file or \windows\hosts file to add an entry for your host.