Laravel 4 &宝塔:[PDOException] SQLSTATE[HY000][2002]没有这样的文件或目录。

时间:2021-08-18 20:33:48

So, my app is on this link

我的应用在这个链接上。

I am able to create a tunnel using Pagoda client and I can view databases via the mySQL CLI. That command being mysql -u<DBusername> -p<DBpassword> -htunnel.pagodabox.com -P<the port tunnel shows me to connect on e.g. 3306>

我可以使用宝塔客户端创建一个隧道,我可以通过mySQL CLI查看数据库。这个命令是mysql -u -p -htunnel.pagodabox.com -p <端口隧道显示了我连接的方式,例如3306> 。

The app works locally. Okay, further i've searched and searched, did the app/database.php configuration, checked the socket, it's okay too, at /var/run/mysqld/mysqld.sock .

应用程序在本地工作。好的,我已经搜索和搜索了,应用程序/数据库。php配置,检查套接字,它也可以,在/var/run/mysqld/mysqld。袜子。

The error is this: In my Boxfile, I have this before-deploy hook before_deploy: - "php artisan migrate:install --env=production"

这个错误是这样的:在我的Boxfile中,我有一个before-deploy钩子before_deploy: -“php artisan迁移:install—env=production”

This causes the [PDOException] SQLSTATE[HY000] [2002] No such file or directory and hence it isn't deployed.

这导致[PDOException] SQLSTATE[HY000][2002]没有这样的文件或目录,因此它没有被部署。

Any help\reference would be really welcome. Any more info can be given too. Cheers!

任何帮助\参考都是非常受欢迎的。还可以提供更多的信息。干杯!

1 个解决方案

#1


0  

Modified the mysql configuration in my app/config/database.php to this:

在我的app/config/数据库中修改了mysql配置。php:

'host' => isset($_SERVER['DB1_HOST']) ? $_SERVER['DB1_HOST'] : '127.0.0.1', 'database' => isset($_SERVER['DB1_NAME']) ? $_SERVER['DB1_NAME'] : '<db_name>', 'username' => isset($_SERVER['DB1_USER']) ? $_SERVER['DB1_USER'] : '<mysql_username>', 'password' => isset($_SERVER['DB1_PASS']) ? $_SERVER['DB1_PASS'] : '<mysql_password>',

“主机”= >收取($ _SERVER[' DB1_HOST '])?$ _SERVER[' DB1_HOST ']:127.0.0.1,“数据库”= >收取($ _SERVER[' DB1_NAME '])?$ _SERVER[' DB1_NAME ']:“< db_name >”,“用户名”= >收取($ _SERVER[' DB1_USER '])?$ _SERVER[' DB1_USER ']:“< mysql_username >”,“密码”= >收取($ _SERVER[' DB1_PASS '])?$ _SERVER[' DB1_PASS ']:< mysql_password >,

That solved my problem!

这解决了我的问题!

#1


0  

Modified the mysql configuration in my app/config/database.php to this:

在我的app/config/数据库中修改了mysql配置。php:

'host' => isset($_SERVER['DB1_HOST']) ? $_SERVER['DB1_HOST'] : '127.0.0.1', 'database' => isset($_SERVER['DB1_NAME']) ? $_SERVER['DB1_NAME'] : '<db_name>', 'username' => isset($_SERVER['DB1_USER']) ? $_SERVER['DB1_USER'] : '<mysql_username>', 'password' => isset($_SERVER['DB1_PASS']) ? $_SERVER['DB1_PASS'] : '<mysql_password>',

“主机”= >收取($ _SERVER[' DB1_HOST '])?$ _SERVER[' DB1_HOST ']:127.0.0.1,“数据库”= >收取($ _SERVER[' DB1_NAME '])?$ _SERVER[' DB1_NAME ']:“< db_name >”,“用户名”= >收取($ _SERVER[' DB1_USER '])?$ _SERVER[' DB1_USER ']:“< mysql_username >”,“密码”= >收取($ _SERVER[' DB1_PASS '])?$ _SERVER[' DB1_PASS ']:< mysql_password >,

That solved my problem!

这解决了我的问题!