-1
I’m a beginner and started a PHP project using the Laradock environment. Well, I have everything installed and configured, the containers all running and I can access the project under development and everything. However, I’m not managing to log into phpmyadmin to work with the bank tables! Every time I try, the system returns me the same messages:
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
My file env is like this:
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=cursolaravel55-saldo
DB_USERNAME=root
DB_PASSWORD=root
My database.php file looks like this:
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
When I go to phpmyadmin and enter localhost as server, it already displays the message:
mysqli_real_connect(): (HY000/2002): No such file or directory
I already changed the host to 127.0.0.1, localhost, laradock_mysql_1, it didn’t work. I also downgrade to version 5.7 of mysql, but I think it did not work, because in the installation it seems to be downloading the latest version. Anyway, if anyone can help me with this.
When I give the Docker-Compose build mysql command, it only downloads the latest version of mysql:
docker-compose build mysql
Building mysql
Step 1/9 : ARG MYSQL_VERSION=latest
Step 2/9 : FROM mysql:${MYSQL_VERSION}
---> c7109f74d339
Step 3/9 : LABEL maintainer="Mahmoud Zalt <[email protected]>"
---> Using cache
---> c0b9c7a2ddbc
Step 4/9 : ARG TZ=UTC
---> Using cache
---> 29cc3fbb98b5
Step 5/9 : ENV TZ ${TZ}
---> Using cache
---> 1ba4922aa424
Step 6/9 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && chown -R mysql:root /var/lib/mysql/
---> Using cache
---> a9dcfcf5a481
Step 7/9 : COPY my.cnf /etc/mysql/conf.d/my.cnf
---> Using cache
---> 3844813c2d51
Step 8/9 : CMD ["mysqld"]
---> Using cache
---> e8d89e0eb210
Step 9/9 : EXPOSE 3306
---> Using cache
---> 0518339c2556
Successfully built 0518339c2556
Successfully tagged laradock_mysql:latest
even if I edit the file . env and put that I want version 5.7.
Is there any of that stuff you’re running on Docker ?
– Matheus Barbosa
Yes. I start the containers and through the command Docker ps I can see that everyone is running, including mysql and phpmyadmin
– Cássia
Already tried localhost:port, localhost/phpmyadmin, localhost:port/phpmyadmin ?
– a_diogo
It doesn’t work. I can only access via localhost:8080
– Cássia
Is there any way you can post the command you use to move these containers up? Because it seems to me that the port of phpmyadmin was not mapped, so you can not access, but I’m not sure because I do not know how you are instantiating these containers =)
– Matheus Barbosa