DB users not created when deploying to docker

Hi all,

As title says I am not able to complete the docker deployment method. I am using the YT video linked to in the docs as well as recommended her often. Everything deploys that needs to, the containers are there however the mysql users are not be created via the env file as far as I can tell. The container deploys and is working fine but the app is not able to create the DB/tables due to access denied. I am not even able to use the root password to login to mysql using the password designated in the env file so creating the user for IN manually is not possible either. I’ve tried changing the password different ways, rebuilding the sql container, deleting/rebuilding the whole stack and I still get the same error.

I’m stumped and it seems others have run into this issue also.

Did you edit the mysql-user-dates twice in the env-file?

EDIT: Maybe you can post your env-file here? Just change the sensitive stuff to something non-sensitive.

1 Like

Yes, db info is set in these sections. Even using this config with “ninja” set for both user and passwords it comes back as access denied after rebuilding the containers.


DB connection




using above config. trying to authenticate as root in the mysql container as root using password ninja, access denied as before with any password I have set.

Does the db container run or does it repeatingly restart? Can please post both env- and docker-compose.yml-files here?

The DB container stays running, the APP container appears to continuously restart, I think it keeps retrying to complete the setup? I can’t terminal into the APP container at all.

Wait a second! I thought the root-password was another than ninja.

The above was just an example, it doesn’t matter what I set for the root password or for the user/pass for the IN db. Neither seem to be getting set.

Do you remove the container before restarting it?

Yes I am deleting the containers every time now to ensure no weirdness, containers are rebuilt each time.

Edit: this attempt using username “inja” just for something new to try.

I try changing the user/pass, root pass, the database name all in the env file and I get this every time:
In Connection.php line 822:

SQLSTATE[HY000] [1045] Access denied for user ‘inja’@‘’ (using pa
ssword: YES) (Connection: mysql, SQL: select table_name as name, (data_le
ngth + index_length) as size, table_comment as comment, engine as engi ne, table_collation as collation from information_schema.tables where ta
ble_schema = ‘invoice’ and table_type = ‘BASE TABLE’ order by table_name)

In Connector.php line 65:

SQLSTATE[HY000] [1045] Access denied for user ‘inja’@‘’ (using pa
ssword: YES)

I also looked up mysql password requirements to see if maybe I was using too short but I am always using 9+ characters including numbers and special characters. Really at a loss.

I have also now tried putting " around the password as well as ’ even though I don’t think it is necessary…still access denied.

theres a lot of variables here… db password/permissions, env file … best to have knowledgeable person take a look at the configuration you have directly via remote session. let me know if you need such assistance with the docker deployment/config.

1 Like

Let me think about it, because last days I changed the standard-user and -password in the env-file of my test-system to improve some “safety” (tests for the productive system later, you know :wink: ).

However, if I correctly understand you, you changed the credentials after setting up the system for the first time? The database won’t be deleted after downing and re-upping the containers with docker compose. After credentials were set, it seems they won’t be changed after re-upping the server.

So what I did was starting the containers and to log me in into the sql-database with the root-user. The “new” standard user was in fact built by the env-variables, but it did not have the grants for the ninja-database. I gave it all the grants manually. Then it worked.

Maybe that could help you.


Schmitti! -You made my Friday night!

I’m still not sure the root cause, likely a mistake in setting the user/pass in the very first attempt. BUT, something in your response was the ticket! I did not know that despite deleting the DB container…the DB flat file structure remained and the deployment saw that and used it every time…with NO change. What finally got me passed this was removing those flat files in mysql folder so the DB was actually getting recreated AND BINGO! Instance is working now.

Thank you so much for helping me out on this I so appreciate it!

1 Like

@xisdibik Check above post for possible resolution since you had this same or very similar issue.

1 Like

Hey Warren,

very glad to read that it seems I can do better than only asking questions about Invoice Ninja. :wink:

I hope you’ll enjoy the ninja as I do.

Have a good time and read you later :slight_smile:

1 Like

Oh I will have more questions lol but getting it up and running was a good learning experience and the frustrations totally my fault (usually is).