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/fst.srv.net.pid 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?


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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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