Closed sh-ogawa closed 5 years ago
It also happens except for running migration.
When using sqlite driver, then it ran successfully.
172.17.0.1 isn't the ip address you're connecting to, but the address you're connecting from. The user does not have the required permissions.
Then, when it was 5.7, it was connected normally, and it became such a phenomenon as soon as it was raised to 5.8. What is this?
It's a permission problem at your end. Perhaps the machine that is executing the code changed ip address? Maybe you changed to another project that uses another way to run code? Point is that it's in your end, you can successfully connect to mysql, but mysql says "hey, i don't approve this username and password from that ip address".
I understand this problem. driver setting maybe change required at read and write.
change host ip address, so change ip address written log file.
mysql' => [
'driver' => 'mysql',
'read' => [
'host' => ['172.17.0.1'],
],
'write' => [
'host' => ['172.17.0.1'],
],
],
I will change the question. What if I want to allow all hosts? I tried to set *, but it got an error.
How did you try to set *
? Can you tell us exactly what you did?
Everything was useless
'read' => [
'host' => ['*'],
],
'write' => [
'host' => ['*'],
],
'read' => [
'host' => ['%'],
],
'write' => [
'host' => ['%'],
],
'read' => [
'host' => '*',
],
'write' => [
'host' => '*',
],
Those look like php code. The problem is permissions on your mysql user. That's defined in mysql, not in your php code.
mysql> SHOW GRANTS for 'vagrant'@'%';
+---------------------------------------------------+
| Grants for vagrant@% |
+---------------------------------------------------+
| GRANT ALL PRIVILEGES ON `hoge`.* TO 'vagrant'@'%' |
+---------------------------------------------------+
1 rows in set (0.00 sec)
now check error log, so change log message. sorry.
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from `users` where `id` = 1 and `users`.`deleted_at` is null limit 1)
I am creating an environment using docker, but I feel that the docker network construction method is wrong. I confirm soon..
ver. 5.7 set read/write host in config/database.php -> normal end. ver. 5.7 set read/write host in config/database.php and docker network setting -> normal end.
ver. 5.8 set read/write host in config/database.php -> error end.(and ip address change 172.17.0.1) ver. 5.8 set read/write host in config/database.php and docker network setting -> error end(and ip address change 172.17.0.1).
Now, I read Illuminate\Database\Connection class.
I can not understand the cause at all.
Exception throws Doctrine\DBAL\Driver\PDOConnection line 27. (Call parent constructor.)
In Doctrine\DBAL\Driver\PDOConnection::_construct(), I tried to compare the parameters passed to the parent constructor, but it was exactly the same thing. It seems that PDO is setting the IP address automatically. Is there any way to quit this?
Laravel 5.7(OK)
$dsn = "mysql:host=192.168.70.71;port=3306;dbname=hoge"
$options = {array} [5]
8 = 0
3 = 2
11 = 0
17 = false
20 = false
$password = "vagranthogehoge12e$#"
$user = "vagrant"
Laravel5.8(NG)
$dsn = "mysql:host=192.168.70.71;port=3306;dbname=hoge"
$options = {array} [5]
8 = 0
3 = 2
11 = 0
17 = false
20 = false
$password = "vagranthogehoge12e$"
$username = "vagrant"
The operating environment itself, including the Docker container, is not restarting either. Simply updating to 5.8 will result in an error. I have not written anything in the upgrade guide, so I am very embarrassed.
After upgrading to 5.8 I get the exact same error on my webhost.. Not locally.. what is going on? unprofessional of Laravel team to overlook this?!
It sounds like a mismatch between your application code and docker setup. I would start by verifying that the correct username and password is used. Also, make sure to use a certificate if your database requires ssl.
Great idea, I like it.
Hmm, is it OK to understand that it is temporary? At least IntelliJ's database plugin and mysql workbench can log in without problems. Only Laravel 5.8 can not log in.
I am having the same issue after upgrade to 5.8, not containerised just hosted with Apache. Was working on 5.7, now access denied for any operation on MySQL DB. Can connect to the DB using the credentials in Workbench. Changing .env to connect with root user seems to correct the problem though.
Kindly advise?
I had the same issue and it was a #
symbol in password.
Laravel 5.8 uses the new phpdotenv
package which treats #
symbol as start of comment.
From upgrade guide.
the # character in an unquoted value will now be considered a comment instead of part of the value.
To preserve the previous behavior, you may wrap the environment values in quotes:
@chanafdo thanks a lot, for me the # in the mysql password fixed it
@chanafdo thank you very mach. I confirmed now it works properly.
@chanafdo - lifesaver - thanks very much!
Same for me! # in password is killing. Very strange bug!!
I upgrade laravel 5.7 ->5.8, so I encountered this problem.
.env setting
So, I change config/database.php, but the situation does not change, the same error is vomited.