Common Errors When Using MySQL Programs
This section lists some errors that users frequently encounter when running MySQL programs. Although the problems show up when you try to run clIEnt programs, the solutions to many of the problems involves changing the configuration of the MySQL Server.
1. Access denIEd
An Access denIEd error can have many causes. Often the problem is related to the MySQL accounts that the server allows clIEnt programs to use when connecting. See Section 5.7.8, “Causes of Access denIEd Errors”. See Section 5.7.2, “How the Privilege System Works”.
2. Can't connect to [local] MySQL Server
A MySQL clIEnt on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the filesystem (default /tmp/MySQL.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you don't specify a hostname or if you specify the special hostname localhost.
If the MySQL Server is running on Windows 9x or Me, you can connect only via TCP/IP. If the server is running on Windows NT, 2000, XP, or 2003 and is started with the --enable-named-pipe option, you can also connect with named pipes if you run the clIEnt on the host where the server is running. The name of the named pipe is MySQL by default. If you don't give a hostname when connecting to mysqld, a MySQL client first trIEs to connect to the named pipe. If that doesn't work, it connects to the TCP/IP port. You can force the use of named pipes on Windows by using . as the hostname.
The error (2002) Can't connect to ... normally means that there is no MySQL Server running on the system or that you are using an incorrect Unix socket filename or TCP/IP port number when trying to connect to the server.
Start by checking whether there is a process named mysqld running on your server host. (Use ps xa | grep MySQLd on Unix or the Task Manager on Windows.) If there is no such process, you should start the server. See Section 2.9.2.3,