Home > System Tutorial > LINUX > body text

Modify and crack MariaDB database root password

WBOY
Release: 2024-07-25 09:09:51
Original
758 people have browsed it

修改、破解 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
Copy after login
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; //退出
Copy after login

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 &
Copy after login

"&" 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;
Copy after login

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!

source:linuxprobe.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!