How to migrate an OJS database to a new server running a later version of OJS

I am hoping that someone can advise me on the best way to move a MySQL OJS database to a new server

We are currently running OJS version 3.2.1.1. I am in the process of setting up a brand new server that runs version 3.4.0-7. I know that there are several changes to the database schema between those two versions.

Is there some way I could sqldump the original database, sqlimport it into MySQL on the new server and run some *.sql to make the required schema changes?

I had originally been intending to just point my new server at the existing database, but:

  • the schema is obviously different.
  • I don’t want to upgrade OJS/database on the old server as they are due to be retired.
  • I can’t make a duplicate database (on which to run the upgrade) on the old MySQL server as it is running out of space.

Any words of experience would be very welcome.

Hi Tim,

Do you have shell access to both servers? MySQL has a mysqldump command that can export a database as an SQL file. You can use this command to make a copy of the database, and then move this file to the new server. After creating your database you can import the SQL file using a regular mysql -u yourUser -p yourDatabase < dump.sql type syntax.

There’s no need to run SQL commands on the database to change the schema. The upgrade scripts that come with OJS do this automatically for you during the upgrade.

We have an upgrade guide that is useful: https://docs.pkp.sfu.ca/dev/upgrade-guide/en/

Best
Jason

Of course you need to copy over your files and public directory as well. Just the database isn’t enough.

Thank you both.

So, it seems like I might have been approaching the problem from the wrong angle.

Instead of setting up my new server with the latest version of the OJS and then shoe-horning in the old database, should I have moved the old database to the new server, set up the older version of the OJS on the new server and then upgraded it in the new location?

So, I would move from the old server to the new:

  • /etc/ojs-files
  • /var/www/ojs*
  • the database

, and then upgrade?

There is a script that updates the schema:

sudo php tools/upgrade.php upgrade

I copied the existing database to the new server and ran the database script, and I can now see my journals from OJS 3.4.0-7.

A major breakthrough!

Now I need to work out how to switch from the PHP development server to Apache. I had a couple of attempts at that last week and failed woefully;-)