laraedit/laraedit-docker

No 'homestead' MySQL user?

Closed this issue · 15 comments

@ibourgeois any particular reason why the lines to create the homestead user and database for MySQL are commented out? Without this we can't find any way to enter values in Laravel's config that will successfully connect the app to the database.

https://github.com/laraedit/laraedit-docker/blob/master/src/scripts/mysql.sh#L18-L23

Thanks.

those scripts aren't being used in the docker container, they are only there as a reference of what I still need to implement from homestead.

the default user is root and the password is secret.

I can add a homestead user if you'd like though!

Thanks for the response. We tried setting the .env values as:

DB_USERNAME=root
DB_PASSWORD=secret

and still Laravel erred with Access denied for user 'root'@'localhost'. Only by creating the user ourselves and granting it access did the connection work. What are we missing?

testing that now.

i wasn't able to replicate this. did you create the database first?

if so, are you able to share the logs?

by default, there is no preexisting database in this container. you'll need to create one.

.env file should include:

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_db_name
DB_USERNAME=root
DB_PASSWORD=secret
hedii commented

it makes sense to create the mysql user "homestead" with password "secret" and database "homestead". This way the container is ready to go when we type "laravel new xxxxxx".
like in the homestead vagrant box

agreed. now that I am home, I will work on this first thing in the morning. thanks for the suggestion!

hedii commented

same problem as @waldemarfm i had to create a new user myself. if not, i get Access denied for user 'root'@'localhost'

were you using something like the mysql workbench to access the database?

the reason i ask is because I was unable to trigger any access is denied errors from laravel or from within the container itself. however, i did get access denied when trying to connect with the workbench.

I was able to correct this issue by running the following command:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'secret';

and restarting the mysql service

I have updated this on the dev branch, and if it works, i will push it to master as well.

hedii commented

@ibourgeois i just tested again with a fresh container, same problem.
here is a picture to show you (sorry, i cannot copy paste with my terminal):

1

did you start this container from the command line or with kitematic?

hedii commented

none, i am running a thing like kitematic, but on my server: https://www.synology.com/en-us/dsm/app_packages/Docker

try using no password

hedii commented

changed my .env and remove password for mysql user root: same error message "access denied for ...".
I'll wait for your new version, with the user already created in the image.
Please make a user homestead, not just root user.

i just committed a pull request that creates a homestead user with a password of secret as well as creates the homestead database.

if you allow about 30 minutes to build on the docker hub: https://hub.docker.com/r/laraedit/laraedit/builds/bxwxunhfpeesitqtpkcvdb8/

it should then be available to pull in using docker, kitematic, etc...