Not able to login into mysql from safe mode. How do I fix this?


While setting up phpmyadmin, I got the message ‘no privileges to create database’. I used the flush privileges and grant all to my root user. Afterwards when logging in I get an error saying
Access denied for user 'root'@'localhost' (using password: YES)

The same happens even when I login from terminal.
When I try safe mode using –skip-grant-tables, it starts, but ends immediately as well.

All the threads I visit have solutions where you somehow login and perform some SQL queries. But I am not able to login at all. How do I solve this?


MySQL is an open source database software which is used for storing data. Some time we need to run MySQL Server on safe mode. Please follow the below commands one by one to run MySQL server on safe mode.

  1. First of all you have to stop MySQL Server.

sudo /etc/init.d/mysql stop
2) Now you have to kill all MySQL id by following command.

killall mysqld
3) Now run the following command to start MySQL server in safe mode using the –skip-grant-tables option. This command will start MySQL in safe mode.

mysqld_safe –skip-grant-tables&
4) Now, restart your MySQL

sudo /etc/init.d/mysql start
Hope this helps you, in case you have any questions please feel free to ask in comments.

Answered By – Kevin Cooper

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published