Starting to Work With Databases on Linux

Starting to Work with Database on Linux

It irks and surprises me when I see engineers invoke mysql or postgres on their development box (i.e., localhost) in some funky way. These include: mysql -uroot and psql -Uroot. You should be able to work locally without pretending to be someone else. It’s just weird.

So, do yourself a favor and start right with the correct set of permissions.


After you sudo apt-get install -y mysql-server-5.6, and install without a password issue a: mysql -uroot -e"grant ALL on *.* to $USER" mysql


After you sudo apt-get install -y postgresql, issue a: sudo su -c "psql -c\"create user $USER with SUPERUSER\"" postgres