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.
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.
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.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?