error #1045 - Access denied for user 'root'#'localhost' in phpmyadmin - mysql

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
Even after uninstalling wamp and then reinstalling it's showing the same error.

You can try connecting via the command-line interface using the username and password you expect; if that doesn't work then I presume you'll need to reset your password.
The MySQL manual has detailed instructions for resetting a lost root password.
Generically, those instructions are:
Start MySQL with the --skip-grant-tables option
Connect via the command line client with mysql (or the Start Menu program that corresponds to the command line client).
Run FLUSH PRIVILEGES to load the privilege table
Reset the password with a command like SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass'); adjusting the username, host, and password as needed.
Stop and re-start the MySQL server.

Related

On Windows 10; ERROR 1045 (28000): Access denied for user 'personalUser'#'localhost' (using password: NO)

I have installed Xampp on windows 10 to create a simple app to understand how to use Laravel. I have the last version of Xampp. I configure PHP correctly (with path and so on), but I have a problem with MySQL.
I put the MySQL bin folder address in the user variables path (section in the system properties). In this way, my prompt command recognizes the mysql command. The problem arrives when I write this command: mysql -v. I tried a lot of things, but this Error remains:
ERROR 1045 (28000): Access denied for user 'personalUser'#'localhost' (using password: NO)
PS: personalUser is a generic name to indicate the name of my user.
I have tried to substitute the MariaDB with MySQL in the Xampp folder (I don't know why Xampp has the MariaDB version instead of MySQL). I redownload Xampp twice times. In the xampp folder, in the phpMyAdmin folder, in the file config.inc.php, I changed this command line:
$cfg['Servers'][$i]['password'] = ''; with $cfg['Servers'][$i]['password'] = 'NO';
I tried other things.
Based on the error message you are receiving, it seems that the issue is related to the authentication credentials for the MySQL server. The error message indicates that the user 'personalUser' is not allowed to access the MySQL server because they are not using a password.
To fix this issue, you can try the following steps:
Open the MySQL command-line client by running the mysql command in your terminal or command prompt.
When prompted for a password, enter the password for the user 'personalUser'.
If you do not know the password, you may need to reset it by following the steps in this MySQL documentation: https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
Once you have successfully authenticated with the MySQL server, you can use the GRANT command to grant the 'personalUser' user access to the database you want to use. For example, to grant access to the 'mydatabase' database, you can use the following command:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'personalUser'#'localhost';
After granting the appropriate privileges to the user, you should be able to access the MySQL server and use it with Laravel.
If you continue to have issues, you may need to check the configuration of the MySQL server to make sure that it is set up to allow access from the user 'personalUser'. You can refer to the MySQL documentation for more information on how to configure user access: https://dev.mysql.com/doc/refman/8.0/en/adding-users.html

ERROR 1045 (28000): Access denied for user 'root'#'localhost'

so i installed the MySQL application for the first time. firstly i saw the command line client is not opening so i searched for solutions. they said i must go to the bin directory and run it manually. and after i run the cmd mysql -uroot -p and run it and enter password, it gives me the error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' i tried every single solution on stackoverflow including disabling permissions, running manually which i mentioned above, starting the service from service.msc, running it with password and without.... it just doesnt want to work.
appreciate any help in advance.
GENERIC MYSQL INFO
To start with, read the mysql manual: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
The steps will show you how to shut down the service and start it with an overriding command that doesn't require passwords, then you reset the password. From the manual:
Stop the MySQL server, then restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges and disables account-management statements such as ALTER USER and SET PASSWORD. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
Connect to the MySQL server using the mysql client; no password is necessary because the server was started with --skip-grant-tables:
shell> mysql
In the mysql client, tell the server to reload the grant tables so that account-management statements work:
mysql> FLUSH PRIVILEGES;
Then change the 'root'#'localhost' account password. Replace the password with the password that you want to use. To change the password for a root account with a different hostname part, modify the instructions to use that hostname.
MySQL 5.7.6 and later:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
Or directly on the user table:
UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
XAMPP SPECIFIC
Stop the MySQL service. Open a command window. Change to the XAMPP MySQL directory:
> cd \xampp\mysql\bin\
Run the service without security (note you are running mysqld, not mysql):
> mysqld.exe --skip-grant-tables
The MySQL service will be running in this window, so open another command window and switch to the XAMPP MySQL directory:
> cd \xampp\mysql\bin\
Run the MySQL client:
> mysql
Update the password:
mysql> UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
Exit MySQL:
mysql> \q
Use task manager to cancel the mysqld.exe that is still running. Restart the mysql service.
I got the answer myself. Seemingly, if you get this error, it means that you need to reset your password. You can learn how to do that in MySQL from this link.
And don't forget to change the 5.7 version with your currently installed version in using commands (mine was 8.0).
After that, everything was working fine for me.

Change password in root and error in accessing localhost/phpmyadmin

I tried to change password in my database but after i changed it right away, I got an error saying
mysqli_real_connect(): (HY000/1045): Access denied for user
'root'#'localhost' (using password: NO)
and
phpMyAdmin tried to connect to the MySQL server, and the server
rejected the connection. You should check the host, username and
password in your configuration and make sure that they correspond to
the information given by the administrator of the MySQL server.
How to fix this? Do i need to configure something about the connection and where can I fix it?
Do you able to connect mysql in command line.
#mysql -u root -p
then provide the password to access mysql command line.
if Yes, then please make sure that you given the correct information while installing the phpmyadmin.

mysql: permission error starting a server

I installed mysql community server on my macbook. A password for the user "root#localhost" was created. I have this saved. When I tried to create a connection in mysql admin I noticed that the "default" user was "loisgh". When I try to start the connection using the generated password I get an error that the password is incorrect.
Please advise on how I can create a password for user loisgh OR login as root. I don't see a place where I can enter a user ID.
You can use this command to connect mysql server:
mysql -uroot -p yourpwd
After successful connect to server , to delete the account "loisgh"

Error in opening phpmyadmin

I am using Windows 7 and had just installed WAMP in it. Then when i tried to open it in my browser i get the following error please help me asap..
"Error
MySQL said: Documentation
1045 - Access denied for user 'root'#'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server
rejected the connection. You should check the host, username and
password in your configuration and make sure that they correspond to
the information given by the administrator of the MySQL server. "
did you ever use phpmyadmin or mysql console to setup password?
If yes, go to step 6 and follow on
If no, open the file config.inc.php in folder C:/wamp/apps/phpmyadmin2.10.1 and find this line:
$cfg['Servers'][$i]['password'] = 'TakeOutAnythingInThisSingleQuote'; // MySQL password (only needed
Do as advised, then save the file, shut down and exit wamp. After restart wamp, start all over to setup password