Actions

Introduction to PostgreSQL for MySQL Users

From Han Wiki

Revision as of 12:42, 29 August 2016 by Mhan (talk | contribs) (iwu)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Last tested on Ubuntu 16.04.01 LTS (xenial)

Getting into DB console.

MySQL:

$ mysql -uroot -p

PostgreSQL:

$ sudo su postgres
postgres@hydrogen:~$ psql

Creating DB

Creating a database and granting a user complete access.

MySQL:

mysql> create database mydb;
mysql> grant all on mydb.* to dbuser@localhost identified by 'mypass';

PostgreSQL:

postgres=# create user dbuser with password 'mypass';
postgres=# create database mydb;
postgres=# grant all privileges on database mydb to dbuser;

Exiting from DB

Ctrl-D should exit from both.