Set MySQL root password to blank

()

How to set a blank MySQL root password

In some situations a blank mysql root password is useful, e.g. when providing tests, when multiple database schemes have to be imported, or simply when deploing sql databases are to be provided for tests.

mysql root password

In the terminal, first open MySQL with the root account.

$ sudo mysql

For some MySQL root password configurations, the following command may need to be execute with root password entry.

$ mysql -u root -p

If you need to set an empty password for the root user, this can be created with this command.

MariaDB> SET PASSWORD FOR 'root'@'localhost' = '';

If the password of an existing user is to be set to blank, the following ALTER USER command can be used.

MariaDB> ALTER USER 'user'@'localhost' IDENTIFIED BY '';

The following command creates a new user and will set a blank password.

MariaDB> CREATE USER 'user'@'localhost' IDENTIFIED BY '';

Alternatively, mysqladmin can be used to empty the root password.

$ sudo mysqladmin -u root -pcurrent_password password ''

Note. MySQL can also be managed easily and clearly in the phpMyAdmin graphical web interface.

Conclusion

In this post I show how to set a blank mysql root password can be useful in situations such as when deploying tests when multiple database schemes need to be imported, or simply when sql databases are to be deployed for testing in non-production environments where it should go for simplification without major hurdles.

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

One thought on “Set MySQL root password to blank”

Leave a Reply

Your email address will not be published. Required fields are marked *