Site icon Database Tutorials

Connect to MySQL Server without password in safe mode

This article contains information about mysql safe mode such as start mysql in safe mode, find mysqld_safe location, changing password.

MySQL Safe Mode

Sometime you want to connect to your DB server without password because:

In this article let assume we forgot our userID password and would like to reset it.

Stop MySQL

Find mysqld_safe location

To find the mysqld_safe location run the below command.

Start MySQL in Safe Mode

To start mysql in safe mode run the below command.

–skip-grant-tables: This option causes the server to start without using the privilege system at all, which gives anyone with access to the server unrestricted access to all databases

–skip-networking : This option will block TCP/IP Connection to MySQL except local connection.

This will be an ongoing command until the process is finished so open another shell/terminal window, log in without a password:

You don’t have to provide a password here, nice isn’t it!!

(replace xxx with your own userID and password)

Start MySQL server

Now you should be able to connect to root with your new password :

Give it a try in your development environment at first. Do not forget trying everything on development first.

You can find many more article about MySQL and many databases at dbtut. Use our navigation menu to reach every article you need or our search section on the upper right.

Exit mobile version