There are a number of ways to export and import data from a database. You can use a Mac client like Sequal Pro for MySQL, for example. You can do the same for PostgreSQL, though I have not settled on a Mac client for PostgreSQL.
Mac clients aside, you need can import and export your database SQL from the command line or from a bash script on your server as well. I use the following commands to handle importing and exporting SQL on my servers and development machines.
If you want to export PostgreSQL:
pg_dump -U [username] [database] -f [filepath]
If you want to export MySQL:
mysqldump -u [username] -p[root_password] [database] > [filepath]
Note that there is no space after -p in the MySQL command.
If you want to import PostgreSQL:
psql [database] < [filepath]
If you want to import MySQL:
mysql -u [username] -p[root_password] [database] < [filepath]
You can read about the backup process for PostgreSQL on their website for more details.