account until that hour is up. Similarly, if the account reaches its limit on the number of queries or updates, the server rejects further queries or updates until the hour is up. In all such cases, the server issues appropriate error messages. 

Resource counting occurs per account, not per client. For example, if your account has a query limit of 50, you cannot increase your limit to 100 by making two simultaneous client connections to the server. Queries issued on both connections are counted together. 

The current per-hour resource-use counts can be reset globally for all accounts, or individually for a given account: 

•To reset the current counts to zero for all accounts, issue a FLUSH USER_RESOURCES  statement. 

The counts also can be reset by reloading the grant tables (for example, with a FLUSH PRIVILEGES statement or a mysqladmin reload  command). 

•The counts for an individual account can be reset to zero by setting any of its limits again. Specify a limit value equal to the value currently assigned to the account. 

Per-hour counter resets do not affect the MAX_USER_CONNECTIONS  limit. 

All counts begin at zero when the server starts. Counts do not carry over through server restarts. 

For the MAX_USER_CONNECTIONS  limit, an edge case can occur if the account currently has open the maximum number of connections permitted to it: A disconnect followed quickly by a connect can result in an error ( ER_TOO_MANY_USER_CONNECTIONS  or ER_USER_LIMIT_REACHED ) if the server has not fully processed the disconnect by the time the connect occurs. When the server finishes disconnect processing, another connection is once more permitted. 

## 6.2.21 Troubleshooting Problems Connecting to MySQL 

If you encounter problems when you try to connect to the MySQL server, the following items describe some courses of action you can take to correct the problem. 

•Make sure that the server is running. If it is not, clients cannot connect to it. For example, if an attempt to connect to the server fails with 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) 

•It might be that the server is running, but you are trying to connect using a TCP/IP port, named pipe, or Unix socket file different from the one on which the server is listening. To correct this 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. To find out where the socket file is, you can use this command: 

shell> netstat -ln | grep mysql 

•Make sure that the server has not been configured to ignore network connections or (if you are attempting to connect remotely) that it has not been configured to listen only locally on its network interfaces. If the server was started with the skip_networking  system variable enabled, no TCP/ IP connections are accepted. If the server was started with the bind_address  system variable set to 127.0.0.1 , it listens for TCP/IP connections only locally on the loopback interface and does not accept remote connections. 

