![](/img/trans.png)
[英]Lavavel migrate not work in a LAMP AWS instance with MySQL RDS DB --> SQLSTATE[HY000] [2002] Connection timed out
[英]SOLVED: Laravel: connection to AWS RDS results in a timed out
我試圖使用php artisan migrate
通過 Laravel 將數據庫遷移到 AWS RDS,但是,它給了我這個錯誤:
Illuminate\Database\QueryException : SQLSTATE[08006] [7] could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "xxxxxxxxx.xxxxxxxxx.us-east-2.rds.amazonaws.com" (xx.xxx.xxx.xxx) and accepting
TCP/IP connections on port 5432? (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)
我對這個問題做了一些研究,我發現我需要創建一個新的安全組來允許從我的 IP 地址訪問,並且我添加了一個新規則,類型為“PostgreSQL”及其默認設置,但我的“來源”列中的 IP。 而且我仍然無法遷移我的數據庫(給我與上面相同的錯誤)
這是 .env 文件中的數據庫配置,也許有些字段是錯誤的?
DB_CONNECTION=pgsql
DB_HOST=xxxxxxxxx.xxxxxxxxx.us-east-2.rds.amazonaws.com
DB_PORT=5432
DB_DATABASE=xxxx
DB_USERNAME=xxxx
DB_PASSWORD=xxxx
如有任何幫助,我將不勝感激!
您是否檢查過服務器是否可以訪問RDS?
ssh 進入你的服務器,然后運行
psql -h xxxxxxxxx.xxxxxxxxx.us-east-2.rds.amazonaws.com -d mydb -U myuser
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.