I have installed MySQL 5.7.9 on RHEL 6.5. After installation, when I tried to enter using system root password it is not able to login. I know I have to assign the password for MySQL root user but how can I assign the password when MySQL is not even letting me enter?

When I run the command:

#mysql -u root 

It just kicks me out with this error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I know after MySQL installation it generates the temporary password in /var/log/mysqld.log. But after looking into this file I found nothing except these errors:

0 [ERROR] Incorrect definition of table mysql.db:
          expected column 'User' at position 2 to have type char(32),
          found type char(16).
0 [ERROR] mysql.user has no `Event_priv` column at position 28
0 [ERROR] Event Scheduler: An error occurred when initializing system tables.
          Disabling the Event Scheduler.
0 [Note] /usr/sbin/mysqld: ready for connections.
         Version: '5.7.11' socket: '/var/lib/mysql/mysql.sock' port: 3306
         MySQL Community Server (GPL)  
2 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)
3 [Note] Access denied for user 'root'@'localhost' (using password: YES)  
4 [Note] Access denied for user 'root'@'localhost' (using password: NO)  
5 [Note] Access denied for user 'root'@'localhost' (using password: YES)

1 Answer 1


The problem is with incompatible data files created by a different version installed in the past. The errors show the old datadir was left from an old installation that is not compatible with 5.7.

If your database does not contain any useful data yet, simplest way to fix it is to clear the datadir and let the new version initialize it fresh.

Uninstall 5.7, purge the datadir, and then reinstall. Normal uninstall won't clean it, gimp does not delete your images on uninstall either. You need to delete and reinitialize the datadir, not the application packages. It might be at /var/lib/mysql/ (the default).

If you already have some data in the database you want to keep, you should instead follow the instructions for upgrades.


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.