Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I cannot login to mysql using the terminal.

[root@fst mysql]# mysql -h localhost -u admin -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)

I am sure I have the correct password. The mysql is also running when I check status. The mysql database is also present in the directory /var/lib/mysql/. The host host.myi, host.myd and host.frm are present.

By the way this a related to question on my previous problem MySQL server quit without updating PID file . Initially the problem arise when the root directory was full. To be able to login to directadmin and start mysql, I added a soft link of the /var/lib/mysql/ to /home/mysql. Since my database used up the most of the root directory. The root directory has 50Gb and /home has 1.5Gb. Somehow the /var/lib/mysql/idbdata1 is corrupted. So I move it to another location.

Now, I can start the mysql server but I cannot login into it.

Below are the contents from the myql logs.

121212 20:44:10 mysqld_safe mysqld from pid file /var/lib/mysql/ ended
121212 20:44:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
121212 20:44:10 [Note] Plugin 'FEDERATED' is disabled.
121212 20:44:10 InnoDB: The InnoDB memory heap is disabled
121212 20:44:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121212 20:44:10 InnoDB: Compressed tables use zlib 1.2.3
121212 20:44:10 InnoDB: Using Linux native AIO
121212 20:44:10 InnoDB: Initializing buffer pool, size = 128.0M
121212 20:44:10 InnoDB: Completed initialization of buffer pool
121212 20:44:10 InnoDB: highest supported file format is Barracuda.
121212 20:44:11  InnoDB: Waiting for the background threads to start
121212 20:44:12 InnoDB: 1.1.8 started; log sequence number 1595675
121212 20:44:12 [Note] Server hostname (bind-address): ''; port: 3306
121212 20:44:12 [Note]   - '' resolves to '';
121212 20:44:12 [Note] Server socket created on IP: ''.
121212 20:44:12 [Note] Event Scheduler: Loaded 0 events
121212 20:44:12 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.27-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

I guess there is something wrong with the bind address. How should I fix the problem?

share|improve this question
up vote 2 down vote accepted

Just reset your password and make sure your username and host specifications are correct in the mysql.user table - the "access denied" error means that you're reaching a listener, so your bind address isn't a problem.

Add skip-grant-tables to your my.cnf and restart the service, then take a look at the mysql.user table and make changes to hosts and passwords as needed - make sure you take the skip-grant-tables out of your config when you're done.

share|improve this answer
Thanks @ShaneMadden I was able to view the user table. It is just that some of the db users are not present. As well as the other databases. I made a messed up my db with simple problem from the start. – Pelang Dec 13 '12 at 3:17
mysqld --skip-grant-tables will work too, it's easier then add strings to config.file. – alterpub Dec 13 '12 at 9:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.