• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Reset MySQL 8.0 Root Password On Windows

by admin

If you set a root password previously but have forgotten what it was, you can set a new password. The following procedure is for Windows systems. You must be logged in to Windows as a user with administrative privileges, then follow these steps:

1. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager:

Start Menu -> Control Panel -> Administrative Tools -> Services

2. Then find the MySQL service in the list, and stop it. If your server is not running as a service, you may need to use the Task Manager to force it to stop.

3. Open a console window to get to the command prompt:

Start Menu -> Run -> cmd

Assuming that you installed MySQL to ‘C:\Program Files\MySQL\MySQL Server 8.0’. If you installed MySQL to another location, adjust the following commands accordingly. At the command prompt, execute this command:

C:\> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
C:\> mysqld --skip-grant-tables --skip-networking --enable-named-pipe

The –skip-grant-tables parameter will bypass reading the permissions tables for the MySQL Server; this will allow any user to connect without using a password with full access to all tables. The additional –skip-networking parameter reduces the security risk by stopping the server from accepting connections via TCP/IP; instead named pipes are enabled using –enabled-named-pipe. Named pipes are only available on NT-based systems so TCP/IP must be used for the other Windows OSes. If you are concerned about security you should use a firewall to block external access to the server during this time. Keeping the first console window open, open a second console window and execute the following commands (type each on a single line):

C:\> C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqladmin -u root flush-privileges password "newpwd"
C:\> C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqladmin -u root -p shutdown

Replace ‘newpwd’ with the actual root password that you want to use. The second command will prompt you to enter the new password for access. Enter the password that you assigned in the first command.

Once you have stopped the MySQL server, restart it in normal mode again. If you run the server as a service, you can start it from the Windows Services window. If you start the server manually, use whatever command you would normally use. You should now be able to connect using the new root password.

One way to reset the root password on Windows is to follow the procedure mentioned on the manual in link below.

https://dev.mysql.com/doc/en/resetting-permissions.html

Filed Under: mysql

Some more articles you might also be interested in …

  1. How to Disable Client Access Control in MySQL
  2. Counting Rows Of A Table In MySQL Server
  3. How to use mysqldump without CREATE TABLE statements
  4. MySQL: Identify what user and thread are holding on to a meta data lock that is preventing other queries from running
  5. How to Create a MySQL Docker Container for Testing
  6. Understanding mysqlcheck and myisamchk utilities
  7. How to Add Data Nodes to MySQL Cluster without Restarting the Cluster (version 6.4 and later)
  8. Understanding MySQL Pluggable Authentication
  9. How To Install MySQL RPM packages in a different location to allow multiple versions (versions < 5.6.10)
  10. How to change the audit log path in the MySQL Docker

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright