Skip to content
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

docker-compose run --rm blog-server php artisan migrate --seed not working #54

Closed
rana01645 opened this issue Jan 19, 2019 · 4 comments
Closed

Comments

@rana01645
Copy link

rana01645 commented Jan 19, 2019

When run this command I get this error message

 Illuminate\Database\QueryException  : SQLSTATE[HY000] [1130] Host '172.18.0.8' is not allowed to connect to this MySQL server (SQL: select * from information_schema.tables where table_schema = laravel-blog and table_name = migrations)

  at /application/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [1130] Host '172.18.0.8' is not allowed to connect to this MySQL server")
      /application/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31

  2   PDOException::("SQLSTATE[HY000] [1130] Host '172.18.0.8' is not allowed to connect to this MySQL server")
      /application/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27

  Please use the argument -v to see more details.
@rana01645 rana01645 changed the title php artisan migrate --seed not working docker-compose run --rm blog-server php artisan migrate --seed not working Jan 19, 2019
@guillaumebriday
Copy link
Owner

The ip 172.18.0.8 seems to be false 🤔 Is your DB_HOST variable is set to mysql ?

Or maybe it's related to this issue #25 ?

@rana01645
Copy link
Author

Yes db host is selected to mysql

DB_CONNECTION=mysql
DB_HOST=mysql
DB_DATABASE=laravel-blog
DB_USERNAME=root
DB_PASSWORD=secret

@rana01645
Copy link
Author

I inspected docker container database(laravel-blog_mysql_1).. Seems like there is no database called "laravel-blog" exits and the default password of this database is empty
Is it okay?
local database

@guillaumebriday
Copy link
Owner

Did you change the docker-compose.yml file ?

You need to define the MYSQL_DATABASE env variable as follow : https://github.com/guillaumebriday/laravel-blog/blob/master/docker-compose.yml#L29

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

No branches or pull requests

2 participants