Skip to content

Adding database name env. variable for a new database #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

laeeq80
Copy link

@laeeq80 laeeq80 commented Jun 30, 2019

Hi,

I tested your example and it was working fine but then when I changed the database, it was giving error of

ERROR 1046 (3D000) at line 22: No database selected

Then I solved it by adding the env variable for the database.

--Laeeq

@lindycoder
Copy link
Owner

Hi @laeeq80 , thanks for your interest.

I saw your issue and yeah in my example, i create the database in the setup.sql.

CREATE DATABASE myexample;

If i had more script to add, personnally i would put a use myexample  at the top of my other sql files.

You can use the MYSQL_DATABASE in your setup, but it should be a database name, in this PR you put the name of the setup sql file which doesn't really makes sense to me.

@laeeq80
Copy link
Author

laeeq80 commented Jul 2, 2019

Got it, My case worked because my database name and sql file were same. you can change it to myexample rather than setup if you want.

@Mizzrym
Copy link

Mizzrym commented Sep 23, 2021

You could add
ENV MYSQL_DATABASE=whatever
to the Dockerfile instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants