Skip navigation

Tag Archives: mysql

This probably most of the MAC users must be knowing, but still would like to document it.:

I had a pain myself figuring the way out. Following is the way(or should i say PATH??) to do it:

  • In your terminal, type cd /etc/paths.d/
  • touch mysql(this could be any name)
  • sudo vi mysql
  • [press i to insert] type in the path u want to append to the $PATH variable. In my case i wanted to set mysql’s path. So i had to type(copy paste rather) /usr/local/mysql/bin
  • [esc] :wq! to save the file.

U are done..

There is another way to set up $PATH, which is rather simple but wont be persisted with new sessions(new terminal or terminal tab).

To do so, in terminal u can just say export PATH=$PATH:<the path u want to append>

for ex., PATH=$PATH:/usr/local/mysql/bin

Ok.. so the problem was taking a sql dump in PostgreSQL db of only selected entries in a particular table. Google’d it.. but all in vain.. then came up with a simple workaround…

First create a temporary table in the database as follows:

create table <temporary_table_name> as select * from <table_name> where <some condition>;

This will create a table.

Well.. thats it.. now u can take a dump of that table :-) and then delete it subsequently.

./pg_dump -U <username> -p <port> -d <db_name>
-t <temp_table_name> -f <file_name>

N.B. MySql has a ‘where’ option in mysqldump.. so its quite straight forward there..