"#2002 Cannot log in to the MySQL server" on login - mysql

I am trying to setup drupal on windows 8 with XAMPP but when I try to login to phpmyadmin, I get this error:
I've tried so many different things but I can't seem to get it working. Both Apache and MySQL are running fine from the XAMPP Control Panel.

If you're on a fresh install, config.inc.php file may not exist. You need to rename/copy config.sample.inc.php file then change the relevant line.
please check below link:
phpMyAdmin is throwing a #2002 cannot log in to the mysql server phpmyadmin.

Your phpMyAdmin has been configured with an administrative user ('controluser') to access some advanced features of phpMyAdmin. However, it does not appear that user exists in MySQL. This suggests that XAMPP has
had some glitch in installation, as I believe the XAMPP package normally configures this all for you.
The solution is rather easy; edit your config.inc.php and comment out a few lines by adding // to the beginning of each line. You should do that for the configuration directives for 'controluser', 'controlpass', and 'pmadb', then re-try.
Once you're connected, you can either decide to add the controluser manually or just leave things how they are and not have access to the more advanced features such as bookmarking queries, favorite tables, and so on.

This specific error can have multiple causes.
In your case I think the following settings might be wrong:
username
password
host
port
Just open the config.inc.php in your phpMyAdmin folder and double check the following lines:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['user'] = 'USER';
$cfg['Servers'][$i]['password'] = 'PASSWORD';
Another possible solution you might want to try, could be my answer to this question: enter link description here

Related

MySQL 8.0 Command Line Client crashes right after entering the correct password

MySQL 8.0 Command Line Client crashes right after entering the correct password. I have also checked in services and there is no problem there. I'm using windows
This might be because MYSQL service is stopped.
Open search bar in windows and type services
Open the services application and find MYSQL application.
Click on start
Now open sql command line and try entering password
It is because MySQL Server stop, may be you run another application that use the same port. Try to run MySQL Installer Community, and you will find the program that you have to reconfigure (blue text). Try to configure MySQL Server ant click Test Connection.
It's hard to tell with no debug output or error codes, but disabling ssl might do the trick:
mysql --ssl-mode=DISABLED --host=$MYSQL_HOST --user=$MYSQL_USER ....
I had the same issue, was looking through Google to find an answer and came here. Are you sure, that you provided MySQL password? The root cause of my problem was the fact, that I put the MySQL user instead of MySQL password (the root one). Now everything is working fine.
That could mean that the password is failing. Check CapsLock key.
Go to Control Panel and uninstall MySQL Server only, you don't need to unstall the other MySQL files.
As mentioned here, make sure you can see hidden folders and then delete the following folders:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
C:\Users<your-username>\AppData\Roaming\MySQL
Reinstall MySQL Server Package only
Select another password (looks like the current password is the problem)
Come here and vote me up :)
Do something nice for someone else ;)

"Authentication plugin 'caching_sha2_password' cannot be loaded. The specific module can not be found"

I am new to SQL and keep getting an error "Authentication plugin 'caching_sha2_password' cannot be loaded. The specific module can not be found" while connecting.
In your text editor of choice, open (or create) the /usr/local/etc/my.cnf file and add the following to the [mysqld] section of the file:
default-authentication-plugin=mysql_native_password
Open a terminal window, open an SSH session to your naked Mac Mini Server, and enter the following at the shell prompt:
mysql -u root -p
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'NEWPASSWORD';
Where NEWPASSWORD is the password you want to assign to the MySQL root user.
exit
Reboot your Mac.
Contents of this post is taken from farces.com
You have to "mysql_native_password" here to connect or else you have to configure "caching_sha2_password" plugin properly, as new MySQL comes with "caching_sha2_password" as below:
DROP USER 'your_user_name'#'localhost';
CREATE USER 'your_user_name'#'%' IDENTIFIED WITH mysql_native_password BY 'your_user_password';
GRANT ALL PRIVILEGES ON <db_name>.* TO 'your_user_name'#'%' identified by 'your_user_password';
The easy way around would be to reconfigure your MySQL server with a new authentication method. Just open the MySQL Installer community, and click on reconfigure next to the product MySQL Server. Keep clicking the 'Next' button until you see the authentication method window.
In this window ensure that the 'Use Legacy Authentication Method' option is selected. If not, select that option and proceed with the reconfiguration without changing any more settings. This will handle all errors that you may face when connecting to MySQL from Excel or R, etc.
In your specific case, it could be because your server is not running. To handle that, right-click on This PC on your computer and click on 'Manage'. Select 'Services and Applications' and then 'Services'. Scroll down the list that appears until you see your MySQL server. Click on the service and then click on start the service.
Before following all these instructions to downgrade your server security, make sure you have the latest version of MySQL Workbench! I kept getting that error when I tried running Workbench on an old computer. It had an older version of Workbench installed on it. I ran MySQL Installer and upgraded Workbench to the latest version and stopped getting that error.

EasyPhp - Receive "Missing Plugin" Error When Attempting to Grant Permissions

I've just installed EasyPHP and in the MySQL section I created a new user called "foo" and checked the box to give it all privileges. When I click on the tab to manage the MySQL user accounts the user "foo" is there. But it shows foo's level of privileges only as "USAGE", and when I mouseover that word it says, "no privileges".
So I tried to update the privileges for foo. But when I try to edit them I get the error
"#1524 - Plugin '*E394918EB0645561038DD951D0CABA8042DDFE14' is not
loaded".
Interestingly, when I go back to the tab for user accounts and mouseover the "root" user it states
"Includes all privileges except GRANT"
Maybe this is why it can't grant "foo" any privileges?
Any idea how to give "foo" all privileges? I'd like to use that as my development account.
PS At the bottom of that page there is a message that says: "
Note: phpMyAdmin gets the users' privileges directly from MySQL's
privilege tables. The content of these tables may differ from the
privileges the server uses, if they have been changed manually."
Could this be a possible solution, and if so, could someone share a link that shows how to change the MySQL privilege table manually?
OK, after hours of searching around I'm getting much closer to a solution.
It turns out that there is an error in the EasyPHP installation package that is related to changes from earlier versions of MySQL. Here is the workaround:
(1) Open the file:
:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-binaries\dbserver\mysql5711x86x160717165359\my.ini
(2) Add this line at the end and then save the file:
show_compatibility_56 = on
(3) Restart the MySQL server from the EasyPHP dashboard.
Oh yes, I also ran the following upgrade from the MySQL command line:
mysql_upgrade -u root -p
This has cleared up some errors which showed up in other tabs that I didn't mention, such as not having permission to access the server status and not being able to get a list of the MySQL variables.
I still would like to solve the original problem but have spent too much time on this initial stage to work on it tonight. If anyone has info that please post.
I had the same issue. What I did to fix it was quite simple.
Exit EasyPhp.
Navigate to directory **\EasyPHP-Devserver-17\eds-binaries\dbserver\mysql5717x86xxx\data**
Find and remove the following files with ext .frm & .ibd
innodb_index_stats
innodb_table_stats
slave_master_info
slave_relay_log_info
slave_worker_info
After navigate to directory \EasyPHP-Devserver-17\eds-binaries\dbserver\mysql5717x86xxx\bin
Open command prompt and type
mysql_update -u root -p
<BLANK>
Afterwords you should see MySQL update, aswell as some of easyphp's files.
Exit mysql terminal, and start EasyPhp again.
Hope that helps!

MySQL Says: Cannot connect: invalid settings

We are using XAMPP in a shared environment in our local network. All the projects had the default mysql username and password. Recently I tried to change the user name and password of a project. And now I am not being able to access phpmyadmin. It just displays the following message:
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.
Now no one is able to access the phpmyadmin. How can I solve this?
Error:-Connection for controluser as defined in your configuration failed.
solution:-
because of in your ubuntu system two mysql server running so get confusion solve this problem stop mysql servert first
open terminal
type command:
sudo /etc/init.d/mysql stop
type command:
sudo /opt/lampp/lampp restart
open localhost in browser
you can just solve this by editing the config.inc.php file from the phpmyadmin folder..
This will work fine if you edit the update password with the same username..
Find the line $cfg['Servers'][$i]['password'] =";
Just replace it with
$cfg['Servers'][$i]['password'] = ' ';
Please have a look here for more details
Just add $cfg['Servers'][$i]['host']="127.0.0.1:3307"; if you change port.
There is a bat file 'resetroot.bat' located in the xammp MySQL folder
ie: 'C:\xampp\mysql'
Run the bat file and it will reset the phpadmin passwords. Then start the MySQL service in xammp and try accessing phpmyadmin.
Hope it helps.
In my case it was just because I had forgotten to turn on the 'MySQL' service on the XAMPP control panel. *facepalm*
I am also getting the same error, and finally found the answer with help of first reply of above post. But that is wrong because this error prone due to changed password so all of need to do this to get resolve it.
previous it look like:
" $cfg['Servers'][$i]['password']='';"
after I changed like:
" $cfg['Servers'][$i]['password']='root'; "
The actual reason behind this while installing the XAMMP there is no password but after the that I added password for security. But it did't get updated in config.inc.php so we need to update manually by following above steps.
For my case it seems the mysql server crashed, while it was it running state without any special thing happened. My web app was connected to the db server and was ideal for long time. I was trying to open the phpmyadmin and it started to give issues(same errors mentioned in the question) while connecting to db. After 5 mins I found my db crashed and not at all starting even after trying lot of things.
uninstall the xampp and reinstall it in differnt folder. but before uninstalling it please save the documents of 'htdocs' to the other location and after installing put ur data back to new "htdocs" folder
Remove all lines with $cfg['Servers'] , and keep ONLY the $cfg['Servers'][$i]['host']
Try accessing the phpmyadmin through the "127.0.0.1:8080"
First start the Apache server.
Then click config and open phpMyAdmin(config.inc.php)
Initially you would be having this statement in your config.inc.php
```$cfg['Servers'][$i]['host'] = '12.0.0.0';```
Change the IP address to 'localhost:' i.e.,
$cfg['Servers'][$i]['host'] = 'localhost:';
I did this and the problem solved for me. Hope it helps :)
Step1: Go to xampp/phpMyAdmin/config.inc.php
Step2: Search this: $cfg['Servers'][$i]['host'] = '127.0.0.1';
Step3: Replace with $cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
Here 3307 will be change with your mysql port number, in my case it is 3307. Most of the times it will be 3306.
You can check your mysql port number from here : xampp/mysql/bin/my.ini
find this line-:
$cfg['Servers'][$i]['host'] = 'localhost';
replace it to this -:
$cfg['Servers'][$i]['host'] = '127.0.0.1:3306';
it works for me.in my case I am using port 3306
For my case, I tried to modify Then click config and open with $cfg['Servers'][$i]['host']="127.0.0.1"; then it works.

Can't login into PhpMyAdmin EasyPHP after setting password

I installed EasyPHP 5.3.6, opened PhpMyAdmin, created a new databased and set password for root user. "Naturally" following that I was unable to login into PhpMyAdmin anymore, getting the infamous 1045 Access Denied error.
I tried everything I could find - setting password (in two places) in config.inc.php doesn't seem to work. I also tried changing AllowNoPassword to true (or false, whichever one it was not originally), that didn't do anything. I tried going through phpmyadmin/scripts/signon.php and enter the password there (it's the correct password, I saved it in my password manager) and couldn't login either. I also tried following instructions for resetting MySQL password I found but they used a mysqld-nt.exe which I didn't find in my installation. I also tried uninstalling EasyPHP and reinstalling it (and before doing that I used ccleaner to remove any registry issues it found, though admittedly there was nothing there about mysql) and it of course retained the "incorrect password" and wouldn't let me login.
Short of reformatting my harddrive I'm not sure what else I can do. (How does it keep the broken settings after uninstall??)
Any help would be appreciated.
I also would like to understand why doing something supposedly good to protect your database turns out to be such a painful procedure that it is actually recommended to leave the root user without a password? sigh
Go to EasyPHP-12.1\modules\ folder. Open folder for PhPMyAdmin version you are using (in my case it was phpmyadmin356x130206112511). Find file config.inc.php. Right click edit with Notepad.
Under line:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
paste this line:
$cfg['Servers'][$i]['password'] = 'YOURPASSWORD';
where YOURPASSWORD is your desired password.
Save file and refresh the "Local Web" page.
Clearing cache allowed me to get to phpmyadmin after re-installing easyphp. Thanks to Danae above.
I just killed mysql and restarted, it worked fine for me.
Happened to me also. Unfortunately my internet decided to go down at the same time and I was unable to google this page. The "help" that comes up when you are denied access is really lame ( but hat's off to easyphp creator. ) The "help" tells you " check your configuration files"