Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysqli::real_connect(): (HY000/2002): Permission denied #16516

Closed
zkelo opened this issue Dec 4, 2020 · 11 comments
Closed

mysqli::real_connect(): (HY000/2002): Permission denied #16516

zkelo opened this issue Dec 4, 2020 · 11 comments
Assignees
Labels
question Used when we need feedback from the submitter or when the issue is a question about PMA
Projects

Comments

@zkelo
Copy link

zkelo commented Dec 4, 2020

Describe the bug

When I try to login with correct login and password I'm getting an following error: mysqli::real_connect(): (HY000/2002): Permission denied

To Reproduce

(0. Setup phpMyAdmin;)

  1. Open phpMyAdmin;
  2. Enter correct login and password;
  3. Press "Go" button.

Expected behavior

I successfully login as entered user and can see databases and can do something with them.

Screenshots

image

Server configuration

  • Operating system: CentOS 8
  • Web server: nginx/1.18.0
  • Database version: mysql Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)
  • PHP version: PHP 7.4.13 (cli) (built: Nov 24 2020 10:03:34) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
  • phpMyAdmin version: 5.0.4

Client configuration

  • Browser: Chrome 87.0.4280.88
  • Operating system: Windows 10 Home Single Language

Additional context

Described error happens with this setting's value: $cfg['Servers'][$i]['host'] = 'localhost';. When I changing value of this setting to 127.0.0.1 instead of localhost and entering with correct login and password nothing happens (just reloads page)

@williamdes
Copy link
Member

Hi @zkelo
Could you confirm that using the mysql command line you can login ?

@williamdes williamdes added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Dec 4, 2020
@williamdes williamdes added this to Needs triage in Questions via automation Dec 4, 2020
@zkelo
Copy link
Author

zkelo commented Dec 4, 2020

Hi @zkelo
Could you confirm that using the mysql command line you can login ?

I found a problem with permissions on mysql.sock file and solved it. Now when I'm trying to log in (with correct login and password, of course) nothing happens (just reloads page after I'm press "Go" button)

Also, of course I can log in using mysql client in command line

$ mysql -u demo -pdemo
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 8.0.22 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

How do I know why nothing happens when I press the "Go" button?

@williamdes
Copy link
Member

How do I know why nothing happens when I press the "Go" button?

If you can debug the code maybe you can find the answer but I would say that you can find a better way to make the login work

Could you try to use socket login ?
https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_socket

@zkelo
Copy link
Author

zkelo commented Dec 4, 2020

Could you try to use socket login ?

I've just tried but there's no differences

@zkelo
Copy link
Author

zkelo commented Dec 4, 2020

Does the PMA have any (debug) settings to help you debug the problem?

@williamdes
Copy link
Member

Does the PMA have any (debug) settings to help you debug the problem?

You could use https://docs.phpmyadmin.net/en/latest/config.html#cfg_DBG_sqllog

Here is my debug config lines

$cfg['DBG']['sql'] = true;
$cfg['DBG']['sqllog'] = true;
$cfg['DBG']['demo'] = false;
$cfg['DBG']['simple2fa'] = false;

@zkelo
Copy link
Author

zkelo commented Dec 5, 2020

Here is my debug config lines

$cfg['DBG']['sql'] = true;
$cfg['DBG']['sqllog'] = true;
$cfg['DBG']['demo'] = false;
$cfg['DBG']['simple2fa'] = false;

I changed my config to follow these lines and didn't see anything logs on page and inside browser's console. I think these settings won't help me because I can't go deeper than login form page

@williamdes
Copy link
Member

I changed my config to follow these lines and didn't see anything logs on page and inside browser's console. I think these settings won't help me because I can't go deeper than login form page

You should have some output on the webserver logs, nothing more should show in the front-end

@summea
Copy link

summea commented Apr 12, 2021

How do I know why nothing happens when I press the "Go" button?

If you can debug the code maybe you can find the answer but I would say that you can find a better way to make the login work

Could you try to use socket login ?
https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_socket

I was also seeing a similar error message to the "mysqli::real_connect(): (HY000/2002): Permission denied" part from the original post.

The advice from @williamdes in the quoted post (above) seems to work for my situation. After locating the mysqld.sock file that is being used in my installation, and adding that location in the config file (like this: $cfg['Servers'][$i]['socket'] = '...'; [1]), I was able to log in as expected.

[1] https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_socket

@williamdes williamdes self-assigned this Apr 12, 2021
@williamdes williamdes moved this from Needs triage to Closed/Done in Questions Apr 12, 2021
@wisnuwijo
Copy link

In my case I just need to restart mariadb service on my centos 7 server. It's working now

systemctl restart mariadb

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2022
@williamdes
Copy link
Member

I had this endless issue on ubuntu focal while testing freshly packaged 5.2.1.
I changed localhost to 127.0.0.1 in /etc/phpmyadmin/config-db.php

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Used when we need feedback from the submitter or when the issue is a question about PMA
Projects
Questions
  
Closed/Done
Development

No branches or pull requests

4 participants