Linux MariaDB Root

The password of mariadb root is not available right now, or it was forgotten? Even if the password is not secure enough and you want to change it, no problems should occur. The password can easily be reset, changed or reinstated. The solution for problems like changing the password are kept very simple.

Taking the solution path without problems

With different distributions and the MySQL server there are solutions. The mariadb root should be terminated first. Resetting will work without problems or even approximate limitations. The mariadb root server should be started. Then the option - skip- grant-tables is used and the mariadb root server will work without any problems. The database server should be used. This is combined with the option -skip-networking. So the access from outside is forbidden. Otherwise this access can be used without a password. It becomes easy when mariadb root is running. Then you can simply work without a root password and the database server is connected. There you can reset the password. If the password for the user was changed, then the database server can be terminated. Then the service is restarted. With the new password the user can now connect to the mariadb root server.

Requirements and first steps

To be able to access mariadb root- Serverpaswort, it must be assumed that access to the Linux server mariadb root exists. A drop-in replacement that is fully compatible with MySQL is mostly sent by mariadb root. The used Database and the version must be used with different commands. So the root password can be recovered. To reach the database must be stopped, then it can only be reached manually. The database command line can also be reached without a password. It should be prevented that you can connect to other clients. The database must be activated with this without loading the grant tables. The commercial at the end of the command, this process is run in the background. So the terminal can be used further. The connection to the database can be made as root user. This connection to the database can be used without a password. With the $ mysql-u root option, a database shell prompt is seen immediately. With various prompts, the root can be accessed. There the password can be changed conveniently.

Changing the root password

With modern versions of the mariadb root server the ALT USER command can be used. However, this command will not work if the grant tables are not loaded. FLUSH PRIVILEGES can be used to load the grant tables. With mysql> FLUSH PRIVILEGES the root password can easily be changed. For newer versions than MariaDB 10.1.20 the following command can be used: mysql> ALTER USER 'root'@'localhost'IDENTIFIED BY 'new_password'; .
For versions of MariaDB 10.1.20 and older, the command mysql> SET PASSWORD FOR 'root'@'localhorst'= PASSWORD('new_password'); . Note the new_ password with the new password chosen first. The command ALTER USER can sometimes not work, so UPDATE...SET can usually replace the password. It is important that the grant tables are reloaded afterwards. In both cases you should see the confirmation that the command was executed. The database server can now be stopped and also restarted. The server instance is stopped and sent with SIGTERM. After cleaning up, this command will appear more often.

Current articles