Thursday 22 December 2016

Remeber logs:-

Play with Postgres Console

Login to Postgress Console:-
$ psql -U postgres

See Database:-
$ \l;

Create New Database:-

$ create database Databasename;

To switch databases:
$\connect databasename;
To list all table
$\d
To Insert records:


INSERT
INTO TABLE_NAME (column1,
column2,
column3,...columnN)
VALUES
(value1,
value2,
value3,...valueN);
$insert into articles(title) values(33);


T0 list record:
$ SELECT * FROM articles;




Play with Mysql Console:

Login to Mysql Console:-
$ mysql -u root -p

See Database:-
$ show databases;

Create New Database:-

$ create database Databasename;

To switch databases:
$ use mydb; or connect dbnae;
To list all table
$ show tables;
To Insert records:


INSERT
INTO TABLE_NAME (column1,
column2,
column3,...columnN)
VALUES
(value1,
value2,
value3,...valueN);
$insert into articles(title) values(33);


T0 list record:
$ SELECT * FROM articles;




Dump in Import Postgres:-p -U USERNAME DBNAME > dbexport.pgsql
$ pg_dump -U root blog_development > blog_development.sql


$ psql -U root blog_production < blog_development.sql


Dump in Import Mysql:-p -U USERNAME DBNAME >
dbmysqldump -u [username] -p [database name] > [database name].sql

STEP 1.export.pgsql
$ mysqldump -u root -p blog_development > blog_development.sql
STEP .2 pwd
copy server path : eg : home/ubuntu/app/chumaround/
go to local machine
step:3
scp -r ubuntu@xx.xxx.160.102:/home/ubuntu/app/chumaround/dump_gatherin_rockers.sql /home/bittern102/Desktop/


$ mysql -u root -p blog_production < blog_development.sql







No comments:

Post a Comment

Revert last commit or second last and more....

 Git revert commit_id -m 1 this command willl revert last commit  Git revert commit_id -m 2 this command will revert second commit with same...