PostgreSQL: List all users
Posted . Visible to the public.
SELECT usename FROM pg_user;
Related cards:
MongoDB: List all collections by size
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(sta...
Linux: Create new user with root privileges
-
Create the user
$ adduser user_name
-
Give root privileges
$ visudo
Add user to privileges
user_name ALL=(ALL:ALL) ALL
MySQL: Create Database With User
mysql>CREATE DATABASE memcachedSample;
mysql>CREATE USER 'web20'@'localhost' IDENTIFIED BY 'web20';
mysql>GRANT ALL PRIVILEGES ON memcachedSample.* TO 'web20'@'localhost';
mysql>exit;
PostgreSQL: Backup and Restore DB
Backup:
$ pg_dump -U {user-name} {source_db} -f {dumpfilename.sql}
Restore:
$ psql -U {user-name} -d {desintation_db}-f {dumpfilename.sql}
Posted by Luis Romero to Custom Exposure (2015-06-10 20:44)