sudo apt-get install python-psycopg2
sudo apt-get install postgresql
sudo su - postgres
createuser --superuser examdatabaseuser
psql
\password examdatabaseuser
createdb examdatabase
\connect examdatabase
初始化阿里云数据盘
fdisk -l
fdisk -S 56 /dev/xvdb
mkfs.ext4 /dev/xvdb1
echo ‘/dev/xvdb1 /mnt ext4 defaults 0 0‘ >> /etc/fstab
cat /etc/fstab
mount -a
df -h
psql
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
COMMENT ON SCHEMA public IS ‘standard public schema‘;
# 大换血
[email protected]:~$ dropdb examdatabase;
[email protected]:~$ createdb examdatabase;
[email protected]:~$ psql
psql (9.3.6)
Type "help" for help.
postgres=# \connect examdatabase
You are now connected to database "examdatabase" as user "postgres".
examdatabase=# \d
No relations found.