Answer the question
In order to leave comments, you need to log in
PostgreSQL config?
Windows - 10 Education
OpenServer - 5.6
PhP - 7.1
Apache - PhP 7
PostgreSQL - 9.6
Laravel - 5.3
PostgreSQL 9.6 shipped.
Created a test site, clean Laravel 5.4 blog.
Created a blog table, connected it to .env , configured it.
@if(DB::connection()->getDatabaseName())
<hr>
<h1>Connected successfully to database {{ DB::connection()->getDatabaseName() }} !</h1>
<hr>
@Endiff
// выведет что подключение отрабатывает и имя БД.
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1 // тут я пробовал localhost
DB_PORT=3306 // тут я тоже меня на 5432
DB_DATABASE=market // даже если вернуть бд 'blog' которая рабочая на другом сайте
DB_USERNAME=postgres
DB_PASSWORD=adminer
QueryException in Connection.php line 770:
SQLSTATE[08006] [7] could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 3306?
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 0.0.0.0/0 trust
// пробовал тут прописать в ADDRESS * или ::1/* или ::1/localhost или ::1/127.0.01
# IPv6 local connections:
#host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
// так же тут пробовал создать профиль с которого сижу в ОС user_name 127.0.0.1/32 trust...
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=market
DB_USERNAME=postgres
DB_PASSWORD=adminer
//такая ошибка при попытке php artisan migrate
[PDOException]
SQLSTATE[08006] [7] could not connect to server: Connection refused (0x0000274D/100
61)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 3306?
// изменил порт на DB_PORT=5432
// php artisan migrate выдает ошибку
[Illuminate\Database\QueryException]
SQLSTATE[08006] [7] FATAL: database "market" does not exist (SQL: select * from in
formation_schema.tables where table_schema = public and table_name = migrations)
[PDOException]
SQLSTATE[08006] [7] FATAL: database "market" does not exist
// возвращает имя БД - market
DB::connection()->getDatabaseName()
// через tinker
>>> DB::connection()->getDatabaseName();
=> "market"
Answer the question
In order to leave comments, you need to log in
In connection with the unusual interfaces, there was embarrassment.
Found a solution.
It was necessary to rise to the level above, and create a table from there.
The hierarchy is as follows:
- server ( Servers ) -
DBMS
( PostgreSQL )
- Databases
- Schemas
-
Tables databases, then I accidentally noticed when I was digging into the PhpPgAdmin configs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question