How do I recover a lost MySQL password?

It is not possible to recover a lost mysql password since they are encrypted. But it can always be changed or reset.

To change the root mysql password, follow these steps:

 

1) Stop mysql by executing as root in the command line: service mysql stop

2) Start mysql without the privileges system, execute: mysqld_safe --skip-grant-tables &

3) Open the mysql console by executing: mysql

4) Run the following queries (replace the root password with your desired password)

UPDATE mysql.user SET Password=PASSWORD('yourpassword') WHERE User='root';

FLUSH PRIVILEGES;

5) exit the mysql console and stop mysql: service mysql stop

6) Start mysql by executing: service mysql start

Now the new password is in place.

  • mysql, password, learning
  • 0 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

Basic Mysql commands

This is a list of handy MySQL commands that are use time and time again. At the bottom are...

How can I monitor what my MySQL server is doing?

A handy little Linux application called mytop fits this just perfectly. This is a near-time...

How do I backup MySQL in Linux?

Copying from the mysql directory By default, MySQL databases on servers that use Linux are...

MySQL Optimization, Repair

How MySQL Uses Memory This page lists some of the ways that the mysqld server uses memory, and...

Powered by WHMCompleteSolution