Nội dung
In this article, AZDIGI will show you how to Recover MySQL Root Password on aaPanel. Because in some cases, you need to manipulate Root MySQL but forget or use the aaPanel Templates from the VPS provider, this information will not be provided.
Note: To ensure data safety, you should back up backup data before performing to avoid unnecessary risks in all database-related operations.
I. What is MySQL?
MySQL is the world’s most popular free and open-source database management system and is very popular with developers in application development. Because MySQL is a high-speed, stable and easy-to-use database management system that is portable, works on many operating systems, it provides a large system of very powerful utility functions. With high speed and security, MySQL is well suited for applications that access databases on the internet. Users can download MySQL for free from the homepage.
MySQL has many versions for different operating systems: Win32 version for Windows, Linux, Mac OS X, Unix, FreeBSD, NetBSD, Novell NetWare, SGI Irix, Solaris, SunOS, etc.
MySQL is one of the very basic examples of a Relational Database Management System using Structured Query Language (SQL).
MySQL is used to support Node.js, PHP, Perl, and many other languages, as a place to store information on web pages written in NodeJs, PHP or Perl, etc.
II. Reset MySQL Root Password on aaPanel
To reset the MySQL Root password on aaPanel, we can follow these 2 ways and 3 steps:
Step 1: SSH into your DirectAdmin system
To reset the MySQL Root password on aaPanel, we first need to SSH or access your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSH, we continue with step 2 to change the MySQL/MariaDB configuration at my.cnf
file.
Step 2: Reset MySQL Root Password
Chỉnh sửa cấu hình file
my.cnf
Normally, the my.cnf
configuration file will be located at /etc/my.cnf
or /etc/mysql/my.cnf
and on aaPanel the file will be at /etc/my.cnf
.
To edit the configuration, we use the following command:
vi /etc/my.cnf
At the content of the configuration file, press i to edit and add the content below under the [mysqld] line as shown:
skip-grant-tables
After editing, you save and restart the Mysql service with the command:
systemctl restart mysql
Next, you perform Mysql password reset with the following commands:
mysql -u root -p (Nhấn Enter để tiếp tục) flush privileges; ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'; (NewPassword là mật khẩu mới cần đổi) quit;
Below is the result after I run the commands:
First, you need to log in to aaPanel and go to Databases => root password => enter the new root password => Submit.
So we have successfully changed the Mysql root password.
Step 3: Check the password after changing
To check, use the command below and enter a new password:
mysql -u root -p
If you can login as shown below, you have successfully changed your password.
III. Summary
Hopefully, this article will help you in some cases when you forget or need to recover the MySQL root password on aaPanel. If you find this helpful article, please share it widely.
See more useful articles about aaPanel at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .
- Website AZDIGI: https://azdigi.com/