Cannot log to the local Mysql Server - mysql

I've installed XAMPP. I had put up security barriers but as time went by I forgot my credentials and could no longer access the MySQL server through phpMyAdmin. I keep having the following error trying to enter phpMyAdmin:
1045 Cannot log in to the MySQL server.
I've edited C:\xampp\phpMyAdmin\config.inc to change my passwords but I had no success afterwards. I've altered the bit:
Authentication method (config, http or cookie based)
$cfg['Servers'][$i]['user'] = 'xxxxx' ;
$cfg['Servers'][$i]['password'] = 'yyyy' ;
I've run the MySQL resetroot batch file without success.
I've changed the default ports on my Apache and Mysql at the localhost a couple weeks ago and now I can't access mysql.exe.
Can't connect to MYSQL service on 'localhost'(10061).
How can I change the default localhost port?

Did you take a look here?
After installing a local server and trying to access phpMyAdmin, you could possibly encounter the error: #1045 Access Denied for user 'root'#'localhost' (using password: YES).
If root#localhost wasn't granted the necessary rights to access the database or you provided the wrong password, you will then encounter this error.
Following this tutorial will help guide you on bypassing this error, for any local host server using phpMyAdmin.

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

Mysql not accepting connections from some sources

I have a MySQL server (v8.0) running on windows server 2016. I also have IIS running and PHPMyAdmin installed. In addition to this, I have a PHP web application which runs on the same server (under IIS) which accesses the MySQL database. Finally, I have several Python scripts which access the MySQL database.
Somehow, I have lost the ability to access the database from the Python scripts, but the web application still works and PHPMyAdmin can see and modify the database.
Even more strangely, I can no longer user MySQL Workbench to access the server from a PC on the local network, and PHPMyAdmin cannot access the users table of the mysql database. I can't change user details at all through PHPMyAdmin, I get the error:
Error in processing request
Error code: 500
Error text: Internal Server Error (rejected)
It seems that the connection to server has been lost.
MySQL Workbench gives me this error:
Your connection attempt failed for user 'user' to the MySQL server at SERVERADDRESS:PORT:
Access denied for user 'user'#'SERVERADDRESS' (using password: YES)
I have checked that the server can accept connections from remote computers by adding bind-address=0.0.0.0 to the my.ini file. I have also checked to ensure that 3306 is allowed through the firewall.
Any ideas on what could be causing this issue?
ADyson and MrApnea pointed me in the right direction.
The problem was caused by my main database user having the host reset from % to localhost, I'm not sure how this happened or when. As the app was running locally, this was not affected, but all other access was denied (including MySQL workbench). My root user is set to local only for security.
To fix this, I connected to the server via RDP and logged in to the console as the root user. I then ran these commands to see the error:
use mysql;
select host, user from user;
This showed me that the main user account had "localhost" in the host. I ran this command to update this user:
update user set host='%' where user='username' and host='localhost'; flush privileges;

Is there any way to get my WP database if I've lost access to root on mysql?

Few minutes ago I've done very unecessary move. I wanted to change password to root on my localhost server (I'm using WAMP any my MYSQL version is 5.7.21) and I picked the "SHA-256" option, now I have these errors in my PHPMyAdmin Panel:
#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [sha256_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
I've had an wordpress database on my local server and mainly everything that I want is just to recover it, or also change the root password to do anything... I've read some questions there and the method with changing
default-authentication_plugin = mysql_native_password
in "my.ini" isn't working for me. I tried to run init file with
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
and it's not working too. Is there any other way to change my password or only recover my wp database from it?

Remote access MySql via remote phpMyAdmin

I have a phpMyAdmin with MySQL on a linux remote machine to which I can connect with no problem with a browser.
But when I am trying to connect a DB in MySQL from a .NET program in my machine, I am getting an error message:
Authentication to host 'theIpNumber' for user 'newUserName' using method 'mysql_native_password' failed with message: Access denied for user 'newUserName'#'myMachineName' (using password: YES)
I tried to configured it like it is explained here: http://www.devside.net/wamp-server/accessing-mysql-or-phpmyadmin-from-outside
creating a new user with password in phpMyAdmin and changing the config.inc.php
Then in my app.config I have the connection string with:
connectionString="server=theIpNumber;UserId=newUserName;Password=newUserPassword;database=theDB"
But I am still getting the same error message when I run my program. Any idea how to solve this?
Finally I solved it adding in phpMyAdmin another user with the same name "newUserName" and password, and with the host value "%"

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