-1

I'm using xampp. I also downloaded MySQL Database. Then I have created a database with Mysql Database, with

  • username: root,password = 123456789.

Then I start Xampp Apache and Mysql. When I try to connect to localhost:8080/phpmyadmin, I receive this kind of error:

Messaggio di MySQL: Documentazione

Impossibile connettersi: impostazioni non valide. mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)

phpMyAdmin ha provato a connettersi al server MySQL, e il server ha rifiutato la connessione. Si dovrebbe controllare il nome dell'host, l'username e la password nel file di configurazione ed assicurarsi che corrispondano alle informazioni fornite dall'amministratore del server MySQL.

So I think that I should modify the file:config.inc.php but the problems are:

  1. I can't modify this file on Mac because it says that I'm not the superuser ( But I am).
  2. I don't know what I should modify.

Can you help me to solve this problem? I need to create a simple login form in Java and I need the connection with a database (maybe you know some other solutions to do this.) Thank you.

Arebhy Sridaran
  • 586
  • 12
  • 28
Keyz23
  • 81
  • 2
  • 4
  • 11
  • 3
    Does this answer your question? [ERROR 1698 (28000): Access denied for user 'root'@'localhost'](https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost) – Paulo Boaventura Jan 23 '20 at 23:58

5 Answers5

4

I had the same problem.

Probably you started XAMPP and clicked "Go to Application" and saw the "HOW-TO Guides" on the started website suggesting to change the root password.

Your error message says that you are trying to access the database without a password - however, you have already set a password for this database.

So, you could just delete your current root password (i.e. set an empty "" as the password) and later on change it - I guess you would like to just be able to access phpMyAdmin and this is the quickest solution.

Start XAMPP and mount the data volume. Open Terminal and enter the following command:

/opt/lampp/bin/mysqladmin --user=root --password=123456789 password ""

(here 123456789 is your current root password which gets replaced by an empty password)

Now you should be able to access phpMyAdmin without any problems. But do not forget to set a password later on.

dcmp
  • 136
  • 1
  • 6
1

Please, execute the following privileges command on your MySQL Server:

GRANT ALL ON *.* TO `root`@`localhost` IDENTIFIED BY '123456789';
GRANT ALL ON *.* TO `root`@`127.0.0.1` IDENTIFIED BY '123456789';

Did it solve your problem?

Cheers,

  • Hi thanks for your answer, can you follow me just another time? I open terminal, and i write: /usr/local/mysql/bin/mysql -uroot -p Then I should paste : GRANT ALL ON *.* TO `root`@`localhost` IDENTIFIED BY '123456789'; GRANT ALL ON *.* TO `root`@`127.0.0.1` IDENTIFIED BY '123456789'; – Keyz23 Jul 01 '18 at 17:43
  • When i insert your code i receive this error: GRANT ALL ON *.* TO `root`@`127.0.0.1` IDENTIFIED BY '123456789'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '123456789'' at line 1 – Keyz23 Jul 01 '18 at 20:23
0

Use: ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

This work for me. Regards

0

I was facing a similar problem, the solution that worked for me was to go through the MariaDB that underlies XAMPP.

1)Click on Open Terminal in the XAMPP utility.

2) In Terminal enter:

mysql -p

3) this will prompt you for a password - enter the one you had set in phpMyAdmin

4) SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');

This should void the root password and allow you to regain access.

-1

Remove the MySQL file. I solved it in this way.

double-beep
  • 5,031
  • 17
  • 33
  • 41
utku glsvn
  • 42
  • 9