Results 1 to 2 of 2

Thread: export mysql db to psql

  1. #1
    Join Date
    Aug 2013
    Beans
    49

    export mysql db to psql

    I have a database in mysql, I'd like to export it and load it into psql, is there an easy method to do this?

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,975
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: export mysql db to psql

    Well, it's not entirely "easy," but if you use mysqldump to create a plain-text version of the database, you can massage the commands it creates to fit the PostgreSQL syntax. It depends a lot on how complex your database is. If it's largely just tables, you'll end up with a bunch of CREATE TABLE commands that are pretty simple to transfer. If you have lots of indexes, triggers, stored procedures, etc., it might be a bit more demanding.

    Another option is to use a program like Microsoft Access that can connect to both databases using ODBC. Then you can create the corresponding empty tables in PG before beginning and use Access to copy their contents from one DB to the other. Again you'll probably have to create things like stored procedures manually. Libre/OpenOffice Base can do this too, but I find it much more clunky to use than Access.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •