• 0

mySQL Sump and Restore


Question

Alrighty. I'm pretty n00b with SSH, so what I'm wanting to do is copy certain tables from a DB, and restore them to another database where these table names already exist.

Eg.

I want to dump:

DB1_USERS

DB1_POSTS

And a few more.

And I want restore them to:

DB2_USERS

DB2_POSTS etc.

Those tables exist already, so I don't want to lose that data.

How do I do this in SSH. Can someone give me the commands please? I'll be using root.

Edit: If a mod could change my type sump to dump, that would be super.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

That's not selecting a DB and a table though.

I'll use phpbb as an example.

I was

user_db1

Table: phpbb_users

to be moved to

user_db2

Table: phpbb_users

Link to comment
Share on other sites

  • 0

INSERT INTO DB2.DB2_USERS

SELECT * FROM DB1.DB1_USERS;

you can reference a database like you would a table in the query. - you need to make sure the user has the correct select/insert privileges across both databases.

using your new example it would be:

INSERT INTO user_db2.phpbb_users

SELECT * FROM user_db1.phpbb_users;

Link to comment
Share on other sites

  • 0

just insert the columns that aren't your primary key, e.g. in phpbb_users thats the user_id column.

out of interest is it PHPBB your trying to upgrade? as if so you shouldn't need to do that, just follow the instructions for a upgrade (from within the ACP)

Link to comment
Share on other sites

  • 0

No, it's not an upgrade.

We currently have Jfusion linking our Joomla to phpBb3. However, after trialling it for 6 months, Joomla is not what we need, or want, so we are going to be using phpBB3 Easy Portal.

I want to combine the databases of the two, without performing maintanance on the curret active DB, just so we can operator the new site in a developer environment, with all of our users and posts etc on there.

As for your suggestion. I really don't know how to do that.

I guess another issue is, if I insert the users, will that then mess with all the posts?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.