我使用Docker首次部署Laravel称为应用程序Firefly iii。我在Digital Ocean的their official Docker image上创建了一个服务器。
我刚运行docker-compose exec firefly_iii_app php artisan migrate --seed
-构建过程中的一步。
但是,我遇到某种连接错误:
In Connection.php line 664:
could not find driver (SQL: select * from information_schema.tables where table_schema = fireflyiii and table_name = migrations)
In PDOConnection.php line 50:
could not find driver
In PDOConnection.php line 46:
could not find driver
我不明白为什么或如何调试它的任何进一步。根据{{3}},在此阶段这不是应该发生的事情。
我已经仔细检查了YAML文件中的密码,以确认它是正确的。
答案 0 :(得分:1)
您应该尝试以下一种方法: 须藤apt-get install php7.0-mysql
答案 1 :(得分:0)
此错误仅是由于未建立MySQL连接。 尝试编辑.env文件,以确保使用正确的用户名,密码和数据库名称。这样可以解决您的问题。
答案 2 :(得分:0)
您正在使用Docker。从这个:
@SpringBootApplication
@EnableConfigurationProperties(ConfigurationUnit.class)
public class DemoApplication {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args);
ConfigurationUnit configurationUnit = context.getBean(ConfigurationUnit.class);
System.out.println(configurationUnit.getConfiList());
}
}
@ConfigurationProperties("example-unit")
public class ConfigurationUnit {
public List<String> confiList = new ArrayList<>();
public List<String> getConfiList() {
return this.confiList;
}
}
看起来您正在使用Postgres,而不是MySQL。来自Firefly III documentation about installation using Docker:
Firefly III假定使用MySQL。如果您使用Postgres,请添加以下内容 命令的环境变量:DB_CONNECTION = pgsql
答案 3 :(得分:-1)
使用 docker,您需要将 DB_HOST
.env
文件从 localhost 切换到 0.0.0.0
DB_HOST=0.0.0.0