HeidiSQL won't list my database
Asked Answered
W

2

10

My postgres yaml part looking like this:

postgres:
    container_name: 'postgres'
    image: postgres:10.1
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=root
      - POSTGRES_DB=myids
    ports:
      - "5432:5432"
    networks:
      - app-network

Then when I am logging in with that credentials using HeidiSQL I cant see my database: enter image description here

Any ideas?

Update thanks to this answer I managed to find my database https://dba.stackexchange.com/a/1304 using this select:

SELECT datname FROM pg_database
WHERE datistemplate = false;

Now the question why HeidiSQL won't show that?

Wristwatch answered 23/11, 2017 at 11:36 Comment(2)
Those are schemas, not databases - those are two very different concepts. With Postgres you connect to one database. Once you are connected, you can't switch to a different database. You can only access the schemas inside that database.Horbal
HeidiSQL issues SELECT nspname FROM pg_catalog.pg_namespace to retrieve all schemata. And yes, HeidiSQL shows schemata, not databases. That's why the Database setting in the session manager is not labelled Databases as in MySQL mode.Hedley
G
14

We have to specify the database name in the connection manager, only then will it display the selected database. Please refer to the images below... enter image description here

enter image description hereenter image description hereenter image description here

There is no provision to view all the databases in PostgreSQL in HeidiSQL, but for MySQL the database name field is optional.

Golub answered 6/9, 2018 at 9:55 Comment(2)
I did specify the name in the connection manager, but got instead connected to the "postgres" database anywayLuben
I apologize for the mistake. I'm in fact connected to the correct DB, the name just isn't displayed correctly and instead HeidiSQL shows the name of the connection session from the session managerLuben
D
0

Also make sure you don't have the star icon selected. Otherwise it will only show the tables marked as favorites

Danonorwegian answered 8/11, 2022 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.