Install Postgresql On Ubuntu

Start with Installing PostgreSql
sudo apt-get install postgresql postgresql-contrib

next to do : Login with admin user    sudo -u postgres psql

\du : to check user available in postgressql

Than change the user Password with Alter user commend .

ALTER USER postgres WITH PASSWORD ‘newpassword’;
you can add new user with commend :
createuser [connection-option…] [option…] [username]
Like wise you can add user and change there attributes and Password too.
To exit form PostgresSQL use this commend  postgres=#\q ;

Advertisements

MySQL command prompt auto-complete

It’s Good Trick

Naveen S Nayak's Blog

If you work on the mysql command line, its nice to have an autocomplete similar to the linux bash where you press the TAB key and the commands complete.

In mysql, we can set it up to a degree to provide some hints when we type. Though it might not complete everything you type, it does complete table names etc.

2 ways to do it ( I am on CentOS 6.5 )

when you log into mysql, use the auto-rehash config option like

mysql --auto-rehash -u root -p

if this does not work, then try creating a file called .my.cnf in your home directory and put the below into it

[mysql]
auto-rehash

View original post

vi/vim delete commands and examples

vi delete commands – reference :-

A lot of times all people need is a quick reference, so I’ll start with a reference of vi/vim delete commands:

x delete current character
dwdelete current word
dddelete current line
5dddelete five lines

d$delete to end of line
d0delete to beginning of line

:1,.d : delete to beginning of file

:.,$d  delete to end of file

delete to end of line or beginning of line :-

To delete all the characters from your current cursor position to the beginning of the current line, use the d0 command, like this:

d0

Searching for Text Strings

Command : Action

/text : Search forward in the file for text

?text : Search backward (up) in the file for text

% : With the cursor on a parentheses, bracket, or brace character, you can press the % key to move the cursor to its matching open or close character

Insert Commands

To return to command mode from insert mode use the escape key.

Command :Action

:w : Write the file to disk

:wq : Write the file to disk and quit the editor

ZZ : Same as :wq

:w! newfile  : Write the file to a new disk file called newfile