shell> mysqladmin --no-defaults -u root version 

The option files that clients use are listed in Section 4.2.2.2, “Using Option Files” . Environment variables are listed in Section 4.9, “Environment Variables” . 

•If you get the following error, it means that you are using an incorrect root  password: 

shell> mysqladmin -u root -p xxxx  ver Access denied for user ’root’@’localhost’ (using password: YES) 

If the preceding error occurs even when you have not specified a password, it means that you have an incorrect password listed in some option file. Try the --no-defaults  option as described in the previous item. 

For information on changing passwords, see Section 6.2.14, “Assigning Account Passwords” . 

If you have lost or forgotten the root  password, see Section B.3.3.2, “How to Reset the Root Password” . 

• localhost  is a synonym for your local host name, and is also the default host to which clients try to connect if you specify no host explicitly. 

You can use a --host=127.0.0.1  option to name the server host explicitly. This causes a TCP/IP connection to the local mysqld  server. You can also use TCP/IP by specifying a --host  option that uses the actual host name of the local host. In this case, the host name must be specified in a user table row on the server host, even though you are running the client program on the same host as the server. 

•The Access denied  error message tells you who you are trying to log in as, the client host from which you are trying to connect, and whether you were using a password. Normally, you should have one row in the user  table that exactly matches the host name and user name that were given in the error message. For example, if you get an error message that contains using password: NO , it means that you tried to log in without a password. 

•If you get an Access denied  error when trying to connect to the database with mysql -u user_name , you may have a problem with the user  table. Check this by executing mysql -u root mysql  and issuing this SQL statement: 

SELECT * FROM user; 

The result should include a row with the Host  and User  columns matching your client’s host name and your MySQL user name. 

•If the following error occurs when you try to connect from a host other than the one on which the MySQL server is running, it means that there is no row in the user  table with a Host  value that matches the client host: 

Host ... is not allowed to connect to this MySQL server 

You can fix this by setting up an account for the combination of client host name and user name that you are using when trying to connect. 

If you do not know the IP address or host name of the machine from which you are connecting, you should put a row with ’%’  as the Host  column value in the user  table. After trying to connect from the client machine, use a SELECT USER()  query to see how you really did connect. Then change the ’%’ in the user  table row to the actual host name that shows up in the log. Otherwise, your system is left insecure because it permits connections from any host for the given user name. 

