In Kubuntu 18 I create docker for laravel 6 app with mysql defined :
mysql:
container_name: "vanilla-crm-db"
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: "MYSQL_ROOT_PASSWORD"
MYSQL_DATABASE: "vanilla-crm-dev"
MYSQL_USER: "MYSQL_USER"
MYSQL_PASSWORD: "MYSQL_PASSWORD"
ports:
- "3330:3306"
volumes:
- "./docker/mysql/data:/var/lib/mysql"
and it works for me. I use MySql Workbench 6.3 for db access. Text I make http tests and I need to create new database for this and load dump of my database in it. Name of this database is wriiten in config/database.php under 'mysql_testing' block
I open Workbench and try to create new database : https://prnt.sc/unjie8 But I do not find “Create database” option, But I see “Create new schema” option and in sql-statement preview I see command
CREATE SCHEMA `vanilla-crm-testing` ;
I expected
Create database ...
command. Is it the same?
and error next:
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE SCHEMA `vanilla-crm-testing` ;
ERROR 1044: Access denied for user 'vanilla-crm-usr'@'%' to database 'vanilla-crm-testing'
SQL Statement:
CREATE SCHEMA `vanilla-crm-testing`
Which is valid way to create testing database?
UPDATED : I tried to create new database in mysql console, like:
mysql
CREATE DATABASE vanilla-crm-testing;
but I got error in docker command line:
$ docker-compose exec app bash
root@09649d3a2b81:/app# mysql
bash: mysql: command not found
My docker app has in Dockerfile :
FROM php:7.3-apache
...
RUN apt-get update && apt-get install --no-install-recommends -y \
apt-utils ghostscript jq libicu-dev libmagick++-dev libpq-dev libfreetype6-dev libjpeg62-turbo-dev zlib1g-dev libzip-dev git zip && \
docker-php-ext-install intl && \
docker-php-ext-install opcache && \
docker-php-ext-install pdo_mysql && \
and no more mysql commands. Are there some more packages I need to install in Dockerfile to have mysql console under docker?
UPDATED # 2: I enter the bash with command :
docker-compose exec mysql bash
root@f216ef80c104:/# uname -a
Linux f216ef80c104 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 GNU/Linux
Where mysql is container_name in docker-compose.yml
Usually I enter mysql console with command:
mysql -u root -h localhost -p
But which must be format of this command in the docker console? I tried several ways and failed...
UPDATED # 3: I installed DBeaver Version 7.2.1.202009201907 and logged into my database and tried to create new database for testing. I got error: https://prnt.sc/uol0z7
How to fix it ? Have I to add some more right my mysql container definitions?
Thanks!
CREATE DATABASE dbnamein Workbench query editor should be possible. Another thing, if you want to login to MySQL container bash the command should bedocker-compose exec mysql bash. Theappis the container for your PHP. Hope it helps.