• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Debian

Reset MySQL Root Password on Debian/Ubuntu

How VPS by How VPS
November 1, 2019
in Debian
0
0
SHARES
15
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Determining your database
  2. Resetting your MySQL password
  3. Resetting your MariaDB password
  4. Conclusion
  5. Want to contribute?


If you have forgotten your MySQL root password, you can reset it by following the steps in this article. The process is quite simple and works on these operating systems:

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Debian 8
  • Debian 9

Determining your database

The table below will tell you which database software is available in the OS repository by default.

|    Operating System    |  MySQL/MariaDB  |
| ---------------------- | --------------- |
| Ubuntu 16.04           | MariaDB         |
| Ubuntu 18.04           | MariaDB         |
| Debian 8               | MySQL           |
| Debian 9               | MySQL           |

If you are still unsure of the database software you have installed, perform the following command:

mysql -V

If you see mysql Ver xxx Distrib x.x.x-MariaDB, for example, you are running MariaDB. Otherwise, you are running MySQL.

If you have MySQL installed, please follow the guide below to reset your password. If you have MariaDB installed, scroll to the “Resetting your MariaDB password” section.

Resetting your MySQL password

First, we must stop the mysql service and grant password-less access:

service mysql stop
mysqld_safe --skip-grant-tables &

Once the mysql service stops, we can now connect to our database server by performing the following command:

mysql -u root mysql

Now, enter the following into the SQL terminal:

UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD') WHERE user='root';
FLUSH PRIVILEGES;

You can now enter the following into the SQL terminal:

exit

You may now restart the mysql service:

service mysql restart

Resetting your MariaDB password

Since MariaDB is (essentially) the same software, the commands are similar. Like the previous section, we need to stop the mariadb process and grant password-less access before continuing:

service mariadb stop
mysqld_safe --skip-grant-tables &

Now, we can connect to our database server:

mysql -u root mysql

Once you see the SQL terminal, enter the following:

UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD') WHERE user='root';
FLUSH PRIVILEGES;

Exit and restart MariaDB:

exit
service mariadb restart

Conclusion

Congratulations! You’ve successfully reset your MySQL/MariaDB server password.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Setup NFS Share on Debian

Next Post

Setup Minecraft Pocket Edition on Debian

Next Post

Setup Minecraft Pocket Edition on Debian

Leave a Reply Cancel reply

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

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet