usemysql;//Enter the mysql database MariaDB[(none)"/> usemysql;//Enter the mysql database MariaDB[(none)">
Home > Article > System Tutorial > Modify and crack MariaDB database root password
There are many ways to change mysql password. Here are 2 options
# /usr/local/mysql/bin/mysqladmin -uroot -p password "New-password" Enter password: 【输入原有密码】 //输入后回车密码就修改成了New-password
# mysql -uroot -p //回车登录mysql系统 Enter password: 【输入原来的密码】 MariaDB [(none)]> use mysql; //进入mysql数据库 MariaDB [(none)]> update user set password=passworD("New-password") where user='root'; MariaDB [(none)]> flush privileges; //刷新数据库 MariaDB [(none)]> exit; //退出
Modification completed!
If you don’t remember the old password, you can only try to crack it. The cracking solution is as follows:
Prerequisite: You must have the highest administrator (root) permissions on the server.
# systemctl stop mysql # /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
"&" means running in the background. If it no longer runs in the background, open another terminal.
# mysql MariaDB [(none)]> use mysql; MariaDB [(none)]> UPDATE user SET password=password("New-password") WHERE user='root'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit;
Crack completed!
The above is the detailed content of Modify and crack MariaDB database root password. For more information, please follow other related articles on the PHP Chinese website!