Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration
Last updated 2 years ago.
0

Is the MySQL server on the same EC2 instance as your project? If that's the case you can just use "localhost" as the host.

Last updated 2 years ago.
0

The MySQL server is on the same EC2 instance as my project. I am using the root user (root@elastic-ip). But when I'm running php artisan migrate, I am getting the same error:

[PDOException]
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '54.186.151.12' (11
1)

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

Last updated 2 years ago.
0

Do you have a different environments configured? Like one for dev and one for prod?

php artisan migrate --env=production
Last updated 2 years ago.
0

No, not on this server. Only live.

Last updated 2 years ago.
0

Now after granting all access to root@% in the MySQL server, I'm getting this error:

[PDOException]
SQLSTATE[HY000] [1130] Host '...' is not allowed to connect to this MySQL server

Last updated 2 years ago.
0

Unfortunately, when it comes to the host name, MySQL distinguishes between localhost and 127.0.0.1. What's more, if you grant access to "%", the server still doesn't allow access via Unix domain sockets (rather than TCP). So you need to explicitly grant access to user@localhost as well as to user@%. See this answer on Stack Overflow: http://stackoverflow.com/a/15707789/239678

Last updated 2 years ago.
0

try sudo apt-get install php5-mysql

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

msutyak msutyak Joined 7 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.