Import Moodle database to a new server

By EssingtonITS team ·

Learn how to import a Moodle database to a new server using specific MySQL commands and track progress for large files with the "pv" command.

When you're moving your database to a new server, you'll need to import it using a command line tool. The basic command for this task is:

mysql -h <Server> -u <database user> -p <database> < mybackupfile.sql

Here's how it works: replace <Server> with your server's address, <database user> with your MySQL username, and <database> with the name of the database you're importing. The -p flag will prompt you to enter your password securely. The mybackupfile.sql is the SQL dump file you're importing.

Now, if you're dealing with a hefty database, you might want to keep an eye on how the import is progressing. This can be particularly useful if you're working with large datasets or if you're on a slower network connection. A handy tool for this is pv, which stands for "Pipe Viewer". It gives you a visual representation of the data flow through a pipe, showing you how much has been transferred and how much remains.

To use pv for monitoring your database import, you can tweak the command like this:

pv mybackupfile.sql | mysql -h <Server> -u <database user> -p <database>

In this setup, pv reads the mybackupfile.sql file and pipes it into the mysql command. You'll see a progress bar, the amount of data transferred, and an estimated time to completion. This can be incredibly helpful for managing expectations and troubleshooting any potential issues during the import process.

Before you start, ensure pv is installed on your system. If it's not, you can usually install it with your package manager. For instance, on Debian-based systems like Ubuntu, you'd run sudo apt-get install pv. On Red Hat-based systems, you might use sudo yum install pv.

Remember, importing databases can be resource-intensive, so it's wise to perform these operations during off-peak hours if possible. This minimises the impact on your server's performance and reduces the risk of running into timeouts or other issues.

Looking to enhance your Linux infrastructure? At EssingtonITS.co.uk, we offer expert support and tailored solutions to optimise your systems. Let us help you achieve seamless integration and improved performance.

Looking to optimise your Learning Management System? EssingtonITS offers tailored solutions to enhance your e-learning environment. Visit EssingtonITS.co.uk for expert IT services, or explore our dedicated hosting and support for Moodle at myelms.co.uk. Let us help you create a seamless and efficient learning experience.

person people found this useful.

Related

Knowledge base 10 Jun 2026

Personal Notebook in eLLM

The personal notebook in eLLM allows users to organise and store notes, images, and files in a private, searchable timeline. It ensures privacy by keeping contents visible only to the user, and it can be integrated with the assistant for personalised answers.

Knowledge base 9 Jun 2026

Git Commands Quick Reference Guide

This quick reference guide covers essential Git commands for repository setup, staging, branching, merging, and working with remote repositories, making it a handy tool for developers to streamline their workflow.

Knowledge base 9 Jun 2026

Organisation Skills in the eLLM Admin Console

The article explains how the eLLM Admin Console allows organisations to create and manage shared instruction sets called "organisation skills" to ensure consistent responses across teams. These skills can be customised, restricted to specific groups, and integrated with extern…

Expand 29 Jul 2026

How AI can support pupils with SEND

Explore how AI tools are aiding pupils with special educational needs and disabilities by simplifying text, breaking down tasks, and enhancing accessibility. Learn about the considerations schools should make before implementation.

Expand 29 Jul 2026

AI policy and practice in further education

Further education colleges need distinct AI policies due to their unique mix of vocational courses, diverse age groups, and specific funding and inspection requirements. This guidance highlights the importance of tailored AI approaches in FE settings.