Set MySQL root password to blank


How to set a blank MySQL root password?

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

$ sudo mysql

For some configurations, the following command may need to be executed, 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 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 ''

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

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?

Leave a Reply

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