Daily Archives: August 29, 2016

Introduction to basic commands in PostgreSQL for MySQL users

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;

Listing DBs

You can list the DBs.

MySQL:

mysql> show databases;

PostgreSQL:

postgres=# \l

Selecting a DB

You can select a DB.

MySQL:

mysql> use mydb;

PostgreSQL:

postgres=# \connect mydb;

After selecting a DB you can go ahead and execute SQL commands.

Listing all tables

You can list tables in a DB.

MySQL:

mysql> show tables;

PostgreSQL:

postgres=# \dt

Change the password of a user

You can list tables in a DB.

MySQL:

mysql> set password for 'dbuser'@'localhost' = password('newpassword');

PostgreSQL:

postgres=# alter user "dbuser" with password 'newpassword';

Exiting from DB

Ctrl-D should exit from both.

Car Repaint Project: Day 4 – Sanding and Second Layer of Paint

Today I spent about 4 hours after church sanding and putting on the second layer of paint. This time, I took time to sand using 400 grit, having learned from putting on the first layer. What I’ve learned is that paint don’t really stick well without enough sanding, especially on vertical pieces like the doors. Even with a good scratches from sanding it can be little frustrating, but it may have something to do with the amount of thinner I’ve added to the paint. Mine was nearly 40 thinner/60 paint, which really isn’t according to many recommendations I had read, including the one on the paint can itself, which recommends little or none.  Anyway, first two layers are supposed to be somewhat thin anyway, in order to speed the drying, and the last coat is supposed to be thicker.  I normally don’t praise the my own work, but after putting on the second coat I had impressed myself. It started to look like a decent paint job!  I’m now a firm believer in using Rust-Oleum. 😉  Of course, having done the work myself, I know all of the little inadequacies and places where there are too much paint or too little, but overall, it’s quite satisfying, albeit back-breaking. This ran into late evening hours, and I won’t get into details of little pesky bugs sticking on the paint and so on.  Just use your common sense if you’re following a similar procedure.

IMG_20160828_211522 IMG_20160828_211533  IMG_20160828_211631 IMG_20160828_211646 IMG_20160828_211707  IMG_20160828_191250  IMG_20160828_211610 IMG_20160828_211513

For a better comparison I should have taken some photos before the job, but I was merely thinking of blogging this as a type of record or a log.  Anyway, I had to rummage through my old photos to find this one (a stitched-up panoramic version) I had taken at Taos several years back.  You can see how the paint was coming off.

nissan-before-paint