{"id":4617,"date":"2015-04-26T19:23:34","date_gmt":"2015-04-26T11:23:34","guid":{"rendered":"http:\/\/rmohan.com\/?p=4617"},"modified":"2015-04-26T19:24:01","modified_gmt":"2015-04-26T11:24:01","slug":"mysql-and-postgresql-rosetta-stone","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4617","title":{"rendered":"MySQL and PostgreSQL rosetta stone"},"content":{"rendered":"<p>This is a short table of useful and common MySQL &amp; PostgreSQL commands put up against each other.<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td><\/td>\n<td>\n<h2>MySQL<\/h2>\n<\/td>\n<td>\n<h2>PostgreSQL<\/h2>\n<\/td>\n<\/tr>\n<tr>\n<td>Command line client<\/td>\n<td>mysql<\/td>\n<td>psql<\/td>\n<\/tr>\n<tr>\n<td>Connect to database<\/td>\n<td>use mysql;<\/td>\n<td>\\connect postgresql;<\/td>\n<\/tr>\n<tr>\n<td>List databases<\/td>\n<td>show databases;<\/td>\n<td>\\l<\/td>\n<\/tr>\n<tr>\n<td>List tables<\/td>\n<td>show tables;<\/td>\n<td>\\dt<\/td>\n<\/tr>\n<tr>\n<td>Describe table<\/td>\n<td>describe table;<\/td>\n<td>\\d table;<\/td>\n<\/tr>\n<tr>\n<td>Show server version<\/td>\n<td>select version();<\/td>\n<td>select version();<\/td>\n<\/tr>\n<tr>\n<td>Show the current time<\/td>\n<td>select now();<\/td>\n<td>select now();<\/td>\n<\/tr>\n<tr>\n<td>Authentication<\/td>\n<td>GRANT ALL PRIVILEGES ON *.* TO \u2018monty\u2019@\u2019localhost&#8217;; (<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/adding-users.html\">http:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/adding-users.html<\/a>)<\/td>\n<td>Edit pg_hba.conf (<a href=\"http:\/\/wiki.postgresql.org\/wiki\/Client_Authentication\">http:\/\/wiki.postgresql.org\/wiki\/Client_Authentication<\/a>)<\/td>\n<\/tr>\n<tr>\n<td>Check user privileges<\/td>\n<td>SHOW GRANTS FOR \u2018root\u2019@\u2019localhost&#8217;;<\/td>\n<td>\\du (List all users and their permission levels)<\/td>\n<\/tr>\n<tr>\n<td>Backup<\/td>\n<td>mysqldump [options] db_name [tbl_name \u2026]<\/td>\n<td>pg_dump [option\u2026] [dbname]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Note for future: This reference list will grow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a short table of useful and common MySQL &amp; PostgreSQL commands put up against each other.<\/p>\n<p> MySQL PostgreSQL Command line client mysql psql Connect to database use mysql; \\connect postgresql; List databases show databases; \\l List tables show tables; \\dt Describe table describe table; \\d table; Show server version select version(); select version(); [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16,29],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4617"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4617"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4617\/revisions"}],"predecessor-version":[{"id":4618,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4617\/revisions\/4618"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}