error # 1698 phpmyadmin "Access denied for user 'root' @ 'localhost'"

1

I just installed the whole Apache package together with PHP and phpMyAdmin. The problem is that when I try to log in I get this error:

  

# 1698 Access denied for user 'root' @ 'localhost'

and

  

mysqli_real_connect (): (HY000 / 1698): Access denied for user 'root' @ 'localhost'

What should I do?

    
asked by fedorqui 03.05.2018 в 03:29
source

2 answers

1

Hello friend, I had the same problem when I installed phpmyadmin after formatting my pc, the solution is simple if at the moment of installing and you try to login and you get the following error: **mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'** you must open a terminal in my case, I use linux but you can also in windows, and you must give permissions to a new user to phpmyadmin in the following way:

enter this line of code in the terminal

sudo mysql -p -u root

he will ask for a password, in my case he will not enter anything.

followed by this line in the terminal

CREATE USER 'newuser'@'%' IDENTIFIED BY 'you_password_here'; He should give you a result similar to this one

Query OK, 0 rows affected (0.00 sec)

then you apply the following line of code that is to give privileges to this new user

**'GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'%' WITH GRANT OPTION;'**

will give you an answer like this:

Query OK, 0 rows affected (0.01 sec)

and ready.

    
answered by 27.10.2018 в 18:21
0
$sudo mysql -u root<p>
[mysql] use mysql;<p>
[mysql] update user set plugin='' where User='root';<p>

[mysql] flush privileges;<p>
[mysql] \q
    
answered by 24.08.2018 в 19:06