Answer the question
In order to leave comments, you need to log in
How to move postgres db to another server?
Actually, subject. There is a dump made via pg_dump.
There are two questions:
1) In the off-doc it is written:
psql dbname < infile... The database dbname will not be created by this command, so you must create it yourself from template0 before executing psql (eg, with createdb -T template0 dbname).
Before restoring an SQL dump, all the users who own objects or were granted permissions on objects in the dumped database must already exist. If they do not, the restore will fail to recreate the objects with the original ownership and/or permissions. (Sometimes this is what you want, but usually it is not.
Answer the question
In order to leave comments, you need to log in
1. \d public.some_table
you will be able to see the description of the table. Not quite the same as in MySQL.
Yes, through createdb -T template0
you just create an empty database, for 95% of cases it’s enough with your head.
2. Yes, there should already be users, since there will be commands for distributing rights in the sql dump. You can watch it through \du или выбрать из вью pg_user
, if you want more hard roots, then watch how this view is assembled and choose from the source.
3. If your postgres version and platform do not differ, then you can transfer it through a binary dump - pg_basebackup
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question