Data migration to another server

Hello,

I have an invoice ninja installation on a server through softaculous. I now have another server and I want to transfer all my data to the new installation again through softaculous but I haven’t managed to find an easy way.

I tried to copy and paste the db from phpmyadmin without success.

Many thanks in advance.

Hi,

We recommend using mysqldump to transfer the database, you’ll also want to copy over the .env file.

Thank you. I will give a go and revert.

Hi,

In regards to migrating to another server … is there a step by step guide written for dummies somewhere?

Things like we recommend using mysqldump to migrate the data, while helpful to someone who knows the ins and outs of mysql, is going to land a lot of people in trouble … hmmm … let me rephrase that have landed keen people in big trouble …

Would be greatly appreciated if there is …

Regards

GV

I found this guide online: How To Migrate Invoice Ninja From One Hosting Server To Another - How To - Ravenous Raven Design

Hello,
I have managed to complete successfully the migration; below are the steps i followed.

I exported the DB form the original destination through phpmyadmin.
I went to the new server and created a new empty database and gave it the name of the exported one.
I then created a new user, same credentials as the exported one.
I imported the db with no errors.
I then installed invoice ninja on the preferred domain name through softaculous.
Finally, I edited the env file to match the migrated DB and the app key.

I hope that helps someone.

1 Like

One slight issue. All the invoices/quotes are generated and printed without the company’s logo despite i have upload it again.

Any ideas?

@david any thoughts?

If you re save the invoice does the pdf update?

It doesn’t work; I even tried creating new quotes and invoices but the logo is missing.

I reapplied the licence just in case without any luck.

This is what it does.
IMG_1253

So the reason for this is most like the system cannot resolve the URL to the image path. You can try adding this variable to your .env file

LOCAL_DOWNLOAD=true

and then attempt to resave.

1 Like

That solved the issue. Many thanks :slight_smile:

Howdy! I was wondering, after exporting the database and then importing it back into the new system, is there any PHP commands that need to be ran for Laravel? Thanks!

No, I don’t believe so

Note: if you upgrade to a newer version you may need to run php artisan migrate

Thanks! I actually ended up doing the following (going off memory) and everything worked perfectly:

  1. Log into old mysql database as root via phpmyadmin (I spun up a phpmyadmin container in Portainer to do this), then export just the Invoice Ninja table.

  2. Find the old APP_KEY you used and use that same one for the new setup (should be in your old .env or docker-compose.yml file)

  3. Spin up the new containers with whatever environment database variables you want (except use the old APP_KEY) so that a brand new mysql container and database is created

  4. Log into new mysql database via the same method as before, create a new table named the same as the old table that was exported, then import the exported SQL file (depending on size you may have to add the phpmyadmin environment variable of “- UPLOAD_LIMIT=256M”

  5. Navigate to the privileges section of the newly created table, you’ll see that your defined mysql user is not attached to this table so we need to add it.

  6. Using the console tab at the bottom of the phpmyadmin page you’ll grant your user permission to this table. The user that you set up in your .env file for your new mysql instance.
    GRANT USAGE ON *.* TO `your-new-user-name`@`%`; GRANT ALL PRIVILEGES ON `your-imported-table-name`.* TO `your-new-user-name`@`%`;

  7. Exit phpmyadmin

  8. Enter “docker compose down” in your terminal to stop and remove the new containers

  9. Edit your .env file and change your DB_DATABASE and MYSQL_DATABASE variables to the name of your old (now newly imported) table name, then save

  10. Back at the command line run “docker compose up -d && docker compose logs -f” to recreate your containers with the env changes and follow the logs to make sure you’re not getting errors.

  11. This method also fixes issues people are getting with plugin errors for “mysql_native_password” when updating from mysql versions < 8.4 because you’re creating the new database container from the get go with the newer “caching_sha2_password”

  12. Log in with your browser and enjoy your new instance of Invoice Ninja!

1 Like