Solvedlaradock Mysql. The server requested authentication method unknown to the client [caching_sha2_password]


  • Docker version: 17.12.0-ce, build c97c6d6
  • Laradock commit: 13f55ef
  • System info: Win
  • System info disto/version: 10


New fresh laradock installation. All default settings. Driver is shared.


Can't connect to the mysql from phpMyAdmin.

#2054 - The server requested authentication method unknown to the client

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

But I can connect to mysql inside mysql container with standard root/root credentials.

I tried to delete all containers and images. Several times downloaded laradock. Tried to reinstall Docker. No success.

Expected behavior:

Can connect to mysql with phpMyAdmin


$ docker logs laradock_mysql_1
2018-02-23T13:22:10.682788Z 0 [Warning] [MY-011070] Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it is deprecated and will be removed in a future release.
2018-02-23T13:22:10.682938Z 0 [Warning] [MY-010915] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-02-23T13:22:10.695441Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc-log) starting as process 1 ...
mbind: Operation not permitted
mbind: Operation not permitted
2018-02-23T13:22:11.537504Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-02-23T13:22:11.542367Z 0 [Warning] [MY-000000] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-02-23T13:22:11.549449Z 0 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.549556Z 0 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.549594Z 0 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.549629Z 0 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.549676Z 0 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.549727Z 0 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.549779Z 0 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.565161Z 0 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.565260Z 0 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-02-23T13:22:11.570621Z 0 [System] [MY-010931] /usr/sbin/mysqld: ready for connections. Version: '8.0.4-rc-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL).
48 Answers

✔️Accepted Answer

alter user 'username'@'localhost' identified with mysql_native_password by 'password'; would fix it.

Other Answers:

Don't uninstall MySQL 8. Sign into mysql using a terminal program:
mysql -u root -p
alter user 'username'@'localhost' identified with mysql_native_password by 'password';

This does the trick.

If you want to use mysql 8 with native password (the old way) you can follow the following steps:

Add this to my.cnf in laradock\mysql\my.cnf under [mysqld]:
Clear the data-folder (will destroy your data), rebuild the mysql container and it should work.

added these lines in docker-compose.yml fixed my issue:

        image: mysql:8
        command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci','--default-authentication-plugin=mysql_native_password']

alter user 'username'@'localhost' identified with mysql_native_password by 'password';
Bravoo. This is the solution

Related Issues:

laradock Mysql. The server requested authentication method unknown to the client [caching_sha2_password]
alter user 'username'@'localhost' identified with mysql_native_password by 'password'; would fix it....
laradock SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
+1 I'm having the same problem here. Info: Docker version ($ docker --version): Docker version 17.12...
laradock MySQL Container fails to start
I had the same issue last night I think it's the mysql version problem What I did was edited laradoc...
laradock ERROR: 404 page not found
I had this problem because the root path in docker-compose.yml differs from the one in nginx default...
laradock When Using docker-compose up mysql MySQL Doesn't Start
I solved this problem This is because of data folder I was running it using mysql 5.7 then abort it ...
laradock Guzzle/Curl connections between multiple projects
That's literary the only change you need to do not going to post the whole of docker-compose file in...
laradock Fails to initialize MySQL database
edit .env DATA_SAVE_PATH=~/.laradock/data to DATA_SAVE_PATH=./data Absolute directory d:\docker_www\...
laradock Laradock mysql exited with code 2
'/tmp' dir not exists on windows please help ...
laradock Unable to start up MySQL container
Do you have any important databases in your machine? If you have no dbs there I think you should rem...
laradock SQLSTATE[HY000] [2002] Connection refused
@asolopovas change your db host to mysql DB_CONNECTION=mysql DB_HOST=mysql Hi I am running laradock ...
laradock How to add SSL to NGINX in laradock.
Within your site config file you will want something similar to the below You will then want to add ...
laradock Routing issue with Laravel and Guzzle
could you try changing to your web server container name whether it's nginx or apache2 lik...
laradock No way to authorize private channels in laravel-echo-server
I solve this problem by adding an alias to nginx service in docker-compose.yml reference: aliases in...
laradock Laradock with both php 5.6 and 7.0
I needed php-fpm 7.0 and 5.6 Hello ...
laradock How can I connect to mysql from outside? Like Workbrench
@pablorsk You can forward the MySQL port to your host by adding the lines To the mysql section of th...
laradock Mariadb plugin 'InnoDB' init function returned error.
The only way I found round this was to backup my /var/lib/mysql and /var/lib/mariadb directories by ...
laradock Too many errors
@lisabonde Please copy the env-example file to .env Within the .env file you can then set your prefe...
laradock Can't install Node & npm
The .env file also has a WORKSPACE_INSTALL_PYTHON which is set to false by default If you set it to ...
laradock How to connect database with my own project with laradock?
@at-tienpham check all container state is up try login PHPMyAdmin: Open Browser http://localhost:88 ...
laradock Multiple sites (Run many laravel projects)
I forked this for work and have an implementation of this working What I did is merge application an...
laradock Docker on Mac is slow
Found the solution: IFSight/d4m-nfs#5 In order to be able to use d4m-nfs you just need to perform th...
laradock xDebug PhpStorm Working Via CLI - Not Working Via Web Page/Apache
@fideloper all you need is xdebug.remote_connect_back = Off Here is a quote from xdebug documentatio...
laradock No releases available for package ""
Doing pecl channel-update as suggested by @ivanferrer solved the problem for me ...
laradock Secure Nginx with Let's Encrypt Guide
Just yesterday i solved this problem for me with nginx Problem Definition There doesn't seem to be a...
laradock Two databases in one MySQL container
If you are struggling with having a non-root user for all databases on container init integrating wh...
laradock Docker-sync integration does not work this way - it has no effect right now
@godbout I was able to get it working on Windows Due to
laradock Cannot build php-fpm
Ok I've just got it working although I'm still not sure on the exact cause When try run docker-compo...
laradock Add Crontab and Supervisor
For the queue part I've simply added a service to the stack: add crontab and supervisor support if w...
laradock Elixir/Mix with Browsersync
@cjmaxik Great! Try using the hostnames nginx and caddy. So I finally managed to have Browsersync wo...
laradock MSSQL Initialise Problem
Hi @Nelsoft-EphraimLambarte it happened a couple of months ago not sure if it´s fixed now but I'm no...
nvidia docker OpenCV Docker error "ImportError: cannot open shared object file: No such file or directory"
I fixed this problem on with (using solution above): ...
compose Docker-compose up failing because "port is already allocated"
I ran into the same issue today (with a postgres container) and despite having tried docker-compose ...
moby The name "/data-container-name" is already used by container <hash>. You have to remove (or rename) that container to be able to reuse that name.
I have a helper function to nuke everything so that our Continuous blah cycle can be tested erm.. co...
compose Compose error "HTTP request took too long to complete"
By simply restarting the docker service via sudo service docker restart I was able to get the aforem...
compose error on launching docker-compose by piping to sh ( echo 'docker-compose ... ' | sh )
I could get it to work by adding the -T parameter to not create a Pseudo-TTY docker-compose exec -T ...
compose docker-compose up fails if network attached to container is removed
Thanks for the report! I think there are several things to note here: First and foremost ...
nvidia docker docker: Error response from daemon: Unknown runtime specified nvidia.
I've also installed correctly but forgot to restart daemon in ubuntu it may resolve your error. ...
compose Error when trying to run docker-compose up. "oci runtime error: container_linux.go:247..."
you gotta make the an executable before building the image: otherwise it cant b...
compose docker-compose up doesn't pull down latest image if the image exists locally
Imagine that git didn't have pull because git fetch && git merge origin/master is functionally ident...
nvidia docker could not select device driver "" with capabilities: [[gpu]].
Hello! If you didn't already make sure you've installed the nvidia-container-toolkit If this doesn't...
moby docker-engine 1.10.2-0~trusty can't install on clean Ubuntu 64-bit 14.04.3
I seem to have resolved this by putting deb trusty main in /etc/...
moby Docker service update --image "could not accessed on a registry to record its digest"
When updating services that need credentials to pull the image you need to pass --with-registry-auth...
compose Docker Compose mounts named volumes as 'root' exclusively
Actually I come here with news it seems what I am trying to achieve is doable but I don't know if th...
compose INTERNAL ERROR: cannot create temporary directory!
Confirming this happened to me Today Was running low on space: After removing a container.. it works...
cookiecutter django No support for python3? I am getting: invalid syntax: raise ValueError, "No frame marked with %s." % fname
For me the issue was that I installed the environ package instead of the django-environ package. ...
compose docker-compose up -d doesn't expose ports when defined with build directive
oh you didn't specify but I'm assuming you're using run instead of up? If so you need --service-port...
compose How does compose chooses subnet for default network?
I'm also running into this issue Another way around this is to set the default-address-pools in your...
ddev In WSL2 ddev start fails at docker-credential-desktop.exe, "error listing credentials"
I had to set credsStore: in my ~/.docker/config.json .. it was previously set to credentials.exe ...