2

I forgot MySql root password. How can I find it?

How can I back up database and import new database?

I tried to change root password and authority in user password, in this file;

"c:/Program Data/MySql/MySql Server 5.6/data/mysql/user.frm"

enter image description here

enter image description here

2 Answers 2

3

Mysql change forgotted password

0) shut down service mysql56 1) go to C:\ProgramData\MySQL\MySQL Server 5.6 (note that ProgramData is a hidden folder) 2) look for file my.ini, open it and add one line skip-grant-tables below [mysqld], save [mysqld] skip-grant-tables 3) start service mysql56 4) by right, you can access the database, and use the query below to update the password update mysql.user set password=PASSWORD('NEW PASSWORD') where user='root'; 5) shun down the service again, remove the line skip-grant-tables save it, and start the service again. try to use the password you set to login. 
Sign up to request clarification or add additional context in comments.

Comments

0

To reset the password Follow these steps (can be helpful if you really forget your password and you can try it anytime, even if you're not in the situation at the moment):

  1. Stop mysql

    sudo /etc/init.d/mysql stop 

or for other distro versions

 sudo /etc/init.d/mysqld stop 
  1. Start MySQL in safe mode

    sudo mysqld_safe --skip-grant-tables & 
  2. Log into MySQL using root

    mysql -uroot 
  3. Select the MySQL database to use

    use mysql; 
  4. Reset the password

    update user set password=PASSWORD("mynewpassword") where User='root'; 
  5. Flush the privileges

    flush privileges; 
  6. Restart the server

    quit 
  7. Stop and start the server again

ubuntu and debian

 sudo /etc/init.d/mysql stop 

...

 sudo /etc/init.d/mysql start 

On CentOS and Fedora and RHEL

 sudo /etc/init.d/mysqld stop ... sudo /etc/init.d/mysqld start 
  1. Login with new password

    mysql -u root -p 

Type new password and enjoy your server again like nothing happened

taken from mysql-resetting-a-lost-mysql-root-password

The wiki also explains other ways to reset the password using a text file.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.