3

By mistaken one of the user of my phpmyadmin got deleted and then while opening phpmyadmin is giving error

"#1045 - Access denied for user 'root'@'localhost' (using password: YES)"

Please help how to recover this account with the same username and password also i am concerned about my databases which are not opening. Whether they will be safe and will recover or lost?

Neetesh
  • 917
  • 1
  • 6
  • 16
  • can you create the same user with the default credentials on server again? – lakshman Jun 01 '15 at 12:27
  • phpmyadmin in server is not opening with error "#1045 - Access denied for user 'root'@'localhost' (using password: YES)" – Neetesh Jun 01 '15 at 12:35
  • @Neetesh Do you have access to the mysql console ? – Nicolas Racine Jun 01 '15 at 12:36
  • No i m unable to open console. Error "#1045 - Access denied for user 'root'@'localhost' (using password: YES)" – Neetesh Jun 01 '15 at 12:37
  • do you have any single user name available means other than root?? – lakshman Jun 01 '15 at 12:40
  • yes i am able to open console with user 'blank' and pass 'blank' when i make changes on config.inc.php – Neetesh Jun 01 '15 at 12:43
  • There are actually 3 `root` accounts on a WAMPServer instance. If you deleted `'root'@'localhost'` can you still get access using `'root'@'127.0.0.1`? To do this enter this in the browser `http://127.0.0.1/localhost/phpmyadmin' then use phpMyAdmin to recreate any missing accounts. – RiggsFolly Jun 02 '15 at 10:47

1 Answers1

0

Try these steps :

Access denied for user 'root'@'localhost' (using password: YES)

  1. service mysqld stop

Stopping mysqld: [ OK ]

  1. mysqld_safe --skip-grant-tables &

mysqld_safe Logging to '/var/lib/mysql/mysqld.err'.

mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

  1. mysql -u root

  2. mysql> UPDATE mysql.user SET password=PASSWORD("new_password") WHERE User='root'; mysql> grant all privileges on *.* to root@localhost identified by 'new_password' with grant option;

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

  1. service mysqld restart

Now, try login using the new password for root

mysqlrockstar
  • 2,536
  • 1
  • 19
  • 36