Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test laravel 5.6 with mysql 8 docker

Due to new hashing algorithms in mysql 8 I am unable to successfully run CI tests in gitlab against this mysql version.

I believe this applies to other CI engines also.

Let's assume my .gitlab-ci.yml is as as simple as that:

build:
  stage: build
  image: chilio/laravel-dusk-ci:stable
  services:
    - mysql:8.0

  script:
    - cp .env.example .env
    - composer install
    - php artisan migrate

And this is the error I get:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

I've found different posts, about reconfiguring mysql instance, but this image is official mysql docker, and I believe it should work the same way, across different versions ...

Images from mysql:5.5 to 5.7 didn't introduce any problems, but with mysql:8.0 I get error as stated before...

So far I have not found any solution to get around this.

Any ideas?

like image 611
Bart Avatar asked Jun 27 '18 22:06

Bart


People also ask

Can I run Laravel without docker?

You can install and run laravel without using docker environment, First of all you need to have composer installed on your operating system before you create a new laravel project locally.

What is sail in Laravel?

Laravel Sail is a light-weight command-line interface for interacting with Laravel's default Docker development environment. Sail provides a great starting point for building a Laravel application using PHP, MySQL, and Redis without requiring prior Docker experience.


1 Answers

Finally I have managed it to work.

in this case, mysql service should be called differently:

services:
     - name: mysql:latest
       command: ["--default-authentication-plugin=mysql_native_password"]
like image 132
Bart Avatar answered Oct 18 '22 09:10

Bart