• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to reset MySQL root password on Linux Debian 11.3

  • 00:25 lsb_release -a
  • 00:38 systemctl status mysql
  • 00:53 mysql -u root -p
  • 01:14 systemctl stop mysql
  • 01:30 systemctl status mysql
  • 01:48 mysqld --skip-grant-tables --user=mysql &
  • 02:15 mysql -u root
  • 02:25 flush privileges;
  • 02:38 alter user 'root'@'localhost' identified by 'Linuxc#9';
  • 03:10 \q
  • 03:20 ps -aux
  • 03:33 kill -9 34275
  • 03:51 systemctl start mysqld
  • 04:00 systemctl status mysql
  • 04:18 mysql -u root -p
  • 04:38 flush privileges;
  • 04:53 \q
{{postValue.id}}

To Reset MySQL Root Password On Debian 11.3

Introduction:

MySQL is a well-known open-source relational database management system developed, distributed, and supported by Oracle Corporation which is used with PHP.

Procedure:

Step 1: Check the installed version of OS by using the below command

[root@linuxhelp ~]# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
No LSB modules are available.

Step 2: Try to login MySQL as root user by using the below command

[root@linuxhelp ~]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Notes: am Forget my mysql password

Step 3: Check the status from MySQL Service by using the below command

[root@linuxhelp ~]# systemctl status mysql
MySQL. Service - MySQL MySQL community-server
     Loaded: loaded (/lib/system/system/MySQL. Service; enabled; vendor preset: >
     Active: active (running) since Wed 2022-05-25 03:04:30 IST; 1 day 2h ago
       Docs: man: MySQL(8)
             https://mysql.com/kb/en/library/systemd/
   Main PID: 782 (MySQL)
     Status: "Taking your SQL requests now..."

Step 4: Stop MySQL Service by using the below command

[root@linuxhelp ~]# systemctl stop mysql

Step 5: Check the status from MySQL Service by using the below command

[root@linuxhelp ~]# systemctl status mysql
MySQL. Service - MySQL community-server
     Loaded: loaded (/lib/system/system/MySQL. Service; enabled; vendor preset: >
     Active: Inactivate (dead) since Wed 2022-05-25 03:04:30 IST; 1 day 2h ago
       Docs: man: MySQL(8)
             https://mysql.com/kb/en/library/systemd/
   Main PID: 782 (MySQL)
     Status: "Taking your SQL requests now..."

Step 6: Run the below command to bypass MySQL authentication by using the below command

[root@linuxhelp ~]# mysqld --skip-grant-tables --user=mysql &
[1] 34275

Step 7: Login MySQL server as a root user by using the below command

[root@linuxhelp ~]# mysql -u root 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Server version: 8.0.26 Source distribution

Step 8: Flush the Privileges by using the below command

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

Step 9: Alter the password for root user by using the below command

mysql> alter user 'root'@'localhost' identified by 'Linuxc#9';
Query OK, 0 rows affected (0.01 sec)

Step 10: Quit MySQL server by using the below command

mysql> \q
Bye

Step 11: Check the MySQL Background process by using the below command

[root@linuxhelp ~]# ps -aux

root         190  0.0  0.0      0     0 ?        S    18:02   0:00 [irq/27-pciehp]
root         191  0.0  0.0      0     0 ?        S    18:02   0:00 [irq/28-pciehp]

root         192  0.0  0.0      0     0 ?        S    18:02   0:00 [irq/29-pciehp]
root         193  0.0  0.0      0     0 ?        S    18:02   0:00 [irq/30-pciehp]
root         194  0.0  0.0      0     0 ?        S    18:02   0:00 [irq/31-pciehp]
root       35289  0.0  0.0      0     0 ?        I    18:27   0:00 [kworker/0:0-events_power_efficient]
mysql      34275  0.8 10.0 1814108 382488 pts/1  Sl   18:28   0:01 mysqld --skip-grant-tables --user=mysql
root       35695  0.0  0.0   7316   908 ?        S    18:30   0:00 sleep 60
root       35732  0.0  0.1  61660  4112 pts/1    R+   18:30   0:00 ps -aux

Step 12: Kill The MySQL Background process by using process id

[root@linuxhelp ~]# kill -9 34275
[1]+  Killed                  mysqld --skip-grant-tables --user=mysql

Step 13: Start the MySQL service by using the below command

[root@linuxhelp ~]# systemctl start mysqld

Step 14: Check the status from MySQL Service by using the below command

[root@linuxhelp ~]# systemctl status mysql
MySQL. Service - MySQL MySQL community-server
     Loaded: loaded (/lib/system/system/MySQL. Service; enabled; vendor preset: >
     Active: active (running) since Wed 2022-05-25 03:04:30 IST; 1 day 2h ago
       Docs: man: MySQL(8)
             https://mysql.com/kb/en/library/systemd/
   Main PID: 782 (MySQL)
     Status: "Taking your SQL requests now..."

Step 15: Login MySQL as a root user by using the below command

[root@linuxhelp ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8

Step 16: Flush the privileges by using the below command

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

Step 17: Quit

mysql>\q
Bye

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Reset MySQL Root Password on Debian 11.3. Your feedback is much welcome.

Tags:
rolando
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Is it possible to reset Root's password in Mysql?

A

yes, it is possible to reset Root's password in Mysql.

Q

Can we customize the data directory path in MySQL?

A

yes, we can change it by editing the MySQL configuration file.

Q

How to backup the table in a database?

A

To backup the table in a database use mysqldump -u root -p database_name table_name > filename.sql

Q

What is the current stable version of MySQL?

A

The latest stable version of MySQL is 8.0.29

Q

What kind of Database is MySQL?

A

Mysql is a relational database system.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help legeek ?
Installation of the call center module

hello

I wish to install a call center in virtual with issabel, I downloaded the latest version of it , but I don' t arrive to install the call center module in issabel. please help me

thanks!

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.