Search code examples
postgresql-9.1postgresql-9.3postgresql-9.4postgresql-9.5postgresql-9.2

Need help configuring PostgreSQL connection to behave like MySQL: Connect to server without auto-selecting default database


In mysql when I enter the following

mysql -u root -p
Password: enter password successfully

I then get into my local server and from here I can view all my databases using SHOW DATABASES. But when I enter

psql -U postgres

I go straight into a database called postgres. I want it so that I connect straight to the server. So like no database selected. So the setup I have for MySQL should be the same as PostgreSQL. I get straight into the server with nothing selected and from there I can go ahead and select.

I tried using ChatGPT but that thing is starting to annoy me now.


Solution

  • Not possible: every MySQL installation has just one database and can have multiple schemas. In MySQL you would call a schema a database. Check the manual for CREATE SCHEMA, an alias for database

    PostgreSQL can have many databases and each database can have many schemas.