Created
June 4, 2011 20:06
-
-
Save xeoncross/1008297 to your computer and use it in GitHub Desktop.
PostgreSQL Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install postgresql | |
| $ sudo apt-get install postgresql | |
| # Login as postgres user | |
| $ sudo -u postgres psql postgres | |
| # Set a password for the "postgres" database role using the command: | |
| $ \password postgres | |
| # Creating a new PostgreSQL user | |
| $ sudo -u postgres createuser -d -R -P <new username> | |
| # Create a new database owned by <username> | |
| $ sudo -u postgres createdb -O <usename> <database name> | |
| # Executing an SQL file | |
| $ psql -f <filename> <database name> <username> | |
| # Removing a database | |
| $ dropdb -U <username> <database name> | |
| # Removing a PostgreSQL user | |
| $ sudo -u postgres dropuser <usernamen> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment