B
B
BonBon Slick2017-01-31 16:44:18
PostgreSQL
BonBon Slick, 2017-01-31 16:44:18

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 
// выведет что подключение отрабатывает и имя БД.

I create my project, do the same settings
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1 // тут я пробовал localhost
DB_PORT=3306 // тут я тоже меня на 5432
DB_DATABASE=market // даже если вернуть бд 'blog' которая рабочая на другом сайте 
DB_USERNAME=postgres
DB_PASSWORD=adminer

Throws an error:
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?

- in PHP 7.1 - php.ini
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

PostgreSQL 9.6 settings itself:
# 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...

I checked the settings of the port on which PostgreSQL is connected = 5432
There is a table in the database, but alas, the connection no longer gives a connection to the second and other sites.
Also, if you write in shell: psql . It will knock out that such a user is not in the database, created a user through PhpPgAdmin with superuser rights. Having driven the same command into the walk, it will knock out that there is no database for this user, created a database, assigned it to the user, called it by the user's name, to no avail.
What am I doing wrong? Where is the mistake and how to fix it?
Addition 1:
Still got a connection to the database with the following configs:
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

Although there is a market database, and we have already received a connection to it.
// возвращает имя БД - market
 DB::connection()->getDatabaseName() 
// через tinker
>>> DB::connection()->getDatabaseName();
=> "market"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BonBon Slick, 2017-01-31
@BonBonSlick

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 question

Ask a Question

731 491 924 answers to any question