摘要:postgresql 指令
登入postgre
>> psql -U postgres
//download postgresql for ubuntu use bitnami
http://downloads.bitnami.com/files/stacks/postgresql/5.4.12-0/bitnami-postgresql-5.4.12-0-module-linux-x64-installer.run3
1:install
sudo bitnami-postgresql-5.4.12-0-module-linux-x64-installer.run3
選擇bitnami路徑/opt/bitnami
2:切換psql
root@linux>>psql
postgres=#
查詢資料庫
mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;
//查詢db、table指令
mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';
mysql: DESCRIBE TABLE
postgresql: \d+ table
連至db
MySQL:use database_name;
postgresql: \connect dbname
查詢table
postgresql: SELECT * FROM pg_catalog.pg_tables