Category: Database

Reset MySQL root password in Ubuntu

Reset MySQL root password in Ubuntu

Here are quick steps to reset mysql root password in Ubuntu 1. Stop the mysql service instance by 1sudo service mysql stop 2. Start mysqld daemon 12sudo mkdir -v /var/run/mysqld && sudo chown mysql /var/run/mysqld sudo mysqld –skip-grant-tables &

Postgresql list table size

Postgresql list table size

Here is a quick script to list all tables and sort by size content : 12345SELECT    relname as "Table",    pg_size_pretty(pg_total_relation_size(relid)) As "Size",    pg_size_pretty(pg_total_relation_size(relid) – pg_relation_size(relid)) as "External Size"    FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;