justuptime.com - monitor your servers & websites

Importing file structure to postgre databases... how to do it?

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 140 posts

Joined: Nov 2003

Anyone know how to import database structures to postgre databases?

It's easy in mysql but I can't figure out how to do it in postgre.. anyone????

Greg K's picture
Moderator

He has: 1,669 posts

Joined: Nov 2003

Not sure it will help, but maybe check out http://phppgadmin.kattare.com/phppgadmin4cvs/ I looked at it and it kinda resembled phpMyAdmin for mySQL databases. I saw in there EXPORT options and SQL query options. Maybe it will work for you if you are used to phpMyAdmin

-Greg

[This space intentionally left blank]

Cool Geek Supplies: www.ThinkGeek.com

They have: 140 posts

Joined: Nov 2003

thanks....... i also saw the export item but not import.... can't seem to find it.

Greg K's picture
Moderator

He has: 1,669 posts

Joined: Nov 2003

in phpMyAdmin, when you export a table or database, you can export it as full SQL code, which you can then execute by putting in the SQL section. (in phpMyAdmin, in the SQL tab, you can actually browse to a local file with the SQL statements in it.

Sorry I can't test it out for you to be positive about the steps, I don't have access to a postgre database (BTW, how the heck do you pronounce that?)

-Greg

[This space intentionally left blank]

Cool Geek Supplies: www.ThinkGeek.com

JeevesBond's picture
Moderator

He has: 3,711 posts

Joined: Jun 2002

I'm not sure of what you're trying to do here. Import a file structure? Is it what Greg's talking about: getting a database backup file into a database?

Greg K wrote: I don't have access to a postgre database (BTW, how the heck do you pronounce that?)

Apparently it's pronounced: post-gres. That's according to a teacher on a course I attended. She was part of a working group that helped write the original SQL specs, so I suppose she knows what she's talking about. Smiling

a Padded Cell our articles site!

They have: 140 posts

Joined: Nov 2003

I am trying to take a mysql database dump and import it into a postgre database...

Just tried playing around with it for 1/2 hr. and I found out how to export, build a database, query the database........ but nothing on uploadging/importing an exisiting database structure....

JeevesBond's picture
Moderator

He has: 3,711 posts

Joined: Jun 2002

Here's a similar scenario, from the Postgres mailing lists:

Quote: > I have a little problem. I have an .sql file ( db dump )
> and i want to import it to postgres on linux.
>
> Does anyone know how i can do it?

You feed it to the command line interface psql.

Example:
psql -h host -p port -d database -U user
Does that help? Smiling

*** EDIT ***
One more thing: you're going to need to convert MySQL into PostgreSQL. Sad Unfortunately all SQL servers implement the specifications slightly differently. You could probably open the sql file--exported from MySQL--in a text editor, then do a find and replace. Running an import will show where the errors in the SQL are.

a Padded Cell our articles site!

They have: 140 posts

Joined: Nov 2003

thanks.