vkovic / laravel-commando

Collection of handy Laravel artisan commands that most projects needs
MIT License
60 stars 10 forks source link

Plugin caching_sha2_password could not be loaded #14

Open vkovic opened 2 years ago

vkovic commented 2 years ago

This is not directly related to this package, but serves more as solution to the problem you might run into.

Under certain circumstances (see below), running the artisan db:import-dump command produces the following error: "Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory"

This happends when we have for e.g 2 docker containers, something like

services:
  php:
    image: php:7.4-apache
    ports:
      - 8080:80

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: default
    ports:
      - 3306:3306

and run docker-compose exec app artisan db:import-dump .


To solve the problem, bash into mysql container docker-compose exec mysql bash and run

mysql -uroot -proot

and in the MySQL terminal:

ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY 'root';