How to reset forgotten password of MySQL/MariaDB On Debian

“How to reset forgotten password of MySQL/MariaDB On Debian 12.xx” is a crucial guide for those with legitimate access and authorization to their servers. Bypassing the root pass word should only be done if you have legitimate access to the server and proper authorization. Unauthorized access to databases can lead to legal and ethical issues. If you are authorized and have legitimate reasons, you can reset the root password by following these steps:

1. Stop the MySQL/MariaDB Service:

    sudo systemctl stop mysql   # For MySQL
    sudo systemctl stop mariadb # For MariaDB

    2. Start MySQL/MariaDB in Safe Mode:

    sudo mysqld_safe --skip-grant-tables --skip-networking &

    3. Login Without a Password:

    mysql -u root

    4. Set a New Root Password:

    USE mysql;
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'yournewpassword';
    FLUSH PRIVILEGES;

    5. Stop the Safe Mode and Restart MySQL/MariaDB:

    • Stop the safe mode:
    sudo pkill mysqld_safe

    6. Start the MySQL/MariaDB service again:

    sudo systemctl start mysql   # For MySQL
    sudo systemctl start mariadb # For MariaDB

    Resetting the forgotten password of MySQL/MariaDB on Debian 12.xx is a manageable process when you have proper authorization and follow the necessary steps carefully. However, it is paramount to always ensure you have proper backups before making any changes to the database configuration or data. Backups provide a safety net, ensuring that in the event of any issues, you can restore your database to its previous state without data loss. Taking this precautionary step safeguards your data integrity and helps maintain the smooth operation of your database systems.

    rockitpinoy
    rockitpinoy
    Articles: 10

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Protected by CleanTalk Anti-Spam