(Everything below has been done on FreeBSD 10.1 with PostgreSQL 9.3)
How to connect to the PostgreSQL database:
su – psql
pgsql -U pgsql -d template1
How to list the PostgreSQL databases
\l #(that is a lowercase L not an i)
How to add a user and grant permissions to a certain PostgreSQL database:
psql -U pgsql -d template1
CREATE USER username WITH PASSWORD ‘password’;
CREATE DATABASE dbname;
GRANT ALL PRIVILEGES ON DATABASE dbname to username;
Remove database and user:
DROP DATABASE dbname;
DROP USER username;
Backup/Dump | Restore a PostgreSQL database:
dump -> pg_dump -U username dbname -f dump.sql
restore -> psql -U username -d dbname -f dump.sql
Hi, so i need to setup some services that use Python 2.7.6, however, since i am using the same Centos5.10 machines that i can’t reload, and i don’t really need to reload them since they are working fine (don’t fix what’s not broken), and on Centos5 you have 2.4.3, and if you decide to upgrade it, you will most likely screw a lot of things in the process, here’s a nice tutorial on how to work things out, using a similar approach to Ruby’s Version Manager or RVM:
1 – Create a user of your choosing, and login as said user.
2 – git clone git://github.com/yyuu/pyenv.git .pyenv
3 – Add env variables to your bash profile (i assume you should be using the bash shell, if you’re using another shell not sure how that goes):
echo ‘export PYENV_ROOT=”$HOME/.pyenv”‘ >> ~/.bash_profile
echo ‘export PATH=”$PYENV_ROOT/bin:$PATH”‘ >> ~/.bash_profile
echo ‘eval “$(pyenv init -)”‘ >> ~/.bash_profile
4 – Logout and relog, or restart shell. I find relog to be the choice for me as i usually have consoles opened for long periods of time, so i might forget and control+D and then miss my settings and wonder why.
5 – Install the Python version you need!
pyenv install 2.7.6
6 – Setup your new installed version as default:
pyenv local 2.7.6
7 – Enjoy your new Python installation!