usemysql;//Enter the mysql database MariaDB[(none)"/> usemysql;//Enter the mysql database MariaDB[(none)">

Home >System Tutorial >LINUX >Modify and crack MariaDB database root password

Modify and crack MariaDB database root password

WBOY
WBOYOriginal
2024-07-25 09:09:51855browse

修改、破解 MariaDB数据库 root 密码

There are many ways to change mysql password. Here are 2 options

Option 1
 # /usr/local/mysql/bin/mysqladmin -uroot -p password "New-password"
 Enter password: 【输入原有密码】 //输入后回车密码就修改成了New-password
Option 2
 # 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn