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

PHPMyAdmin #28

Closed
Zibulon opened this issue May 8, 2019 · 3 comments
Closed

PHPMyAdmin #28

Zibulon opened this issue May 8, 2019 · 3 comments

Comments

@Zibulon
Copy link

Zibulon commented May 8, 2019

I tried to connect by default credentials root/tiger, but have this problem:

Cannot log in to the MySQL server

mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

@pin147
Copy link

pin147 commented May 10, 2019

Instead of localhost use mysql. Yes, it's weird but heh.
I had the same problem when I tried to install WP.

@KappaDistributive
Copy link

@pin147 Can you elaborate? I have the same problem as Zibulon but don't know what you mean by 'using mysql'.

@narendravaghela
Copy link
Member

@KappaDistributive
It's a hostname of MySQL server. See the following example,

<?php
$link = mysqli_connect("mysql", "root", "tiger", null);
if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}
echo "Success: A proper connection to MySQL was made! The docker database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
mysqli_close($link);

See the connection function, we are passing mysql as a first parameter and that is a hostname. Generally, we use localhost for most of the cases, but in this case, it is different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants