1

I am trying to add Bagisto to my application stack on the CNAME shop so I added a new SQL database to host this in Docker-Compose.

When I docker exec -it -u root my_php_container bash and run php artisan migrate I get this when it attempts to create a routine.

SQLSTATE[HY000]: General error: 1419 You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_functio n_creators variable)

My docker-compose container looks like this:

mysql:
  image: 'mysql:latest'
  restart: 'unless-stopped'
  expose:
  - '3306'
  environment:
  - 'MYSQL_DATABASE=${MYSQL_DATABASE}'
  - 'MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}'
  - 'MYSQL_USER=${MYSQL_USER}'
  - 'MYSQL_PASSWORD=${MYSQL_PASSWORD}'
  volumes:
  - 'laravel-db:/var/lib/mysql/'
  networks:
  - 'laravel'

I took a look on SO but cannot find the env for the mysql docker image that regards to this. I tried to add an Entrypoint that just ran an export for log_bin_trust_function_creators=1 but this hasn't worked. Any help appreciated.

I am running Ubuntu 20.04

Jaquarh
  • 6,493
  • 7
  • 34
  • 86

1 Answers1

7

Do this one SET GLOBAL log_bin_trust_function_creators = 1; before running the docker exec -it -u root my_php_container bash or php artisan migrate.

For this you have to login as mysql user and in mysql terminal you have to execute SET GLOBAL log_bin_trust_function_creators = 1;.

Vishnu
  • 158
  • 9
  • 1
    I had to `docker exec -it -u root mysql bash` then run `mysql -u root -p table_name` and login as root then execute the `SET GLOBAL log_bin_trust_function_creators = 1;` thankyou! – Jaquarh Apr 27 '21 at 08:52