If you have previously created a MySQL or MariaDB database and want to use it at Hostinger, you can easily import it and set it up. Here are the steps you need to follow:
Step 1 - Preparations
First, make sure that your database file meets the following requirements:
The file format is .sql or .sql.zip
It does not contain commands to create or delete a database, such as
DROP DATABASE IF EXISTS
orCREATE DATABASE IF NOT EXISTS
Therea are no commands that require SUPER privileges, such as
GRANT ALL PRIVILEGES
It does not include lines with
DEFINER
orPROCEDURE
, orTRIGGER
If your project requires SUPER privileges for databases, you can consider migrating to a VPS plan 💡
Step 2 - Create a New Database
Navigate to Websites → Manage, search for Database Management on the sidebar, and click on it. Once there, select the website to which the database will be assigned from the dropdown list.
Next, enter the database name, username and password. You can find a detailed guide here: How to Create a New Database.
Step 3 - Import Your Database's Backup
Open your newly created database using phpMyAdmin, click on the Import button and select the backup file from your computer. Here is a dedicated article: How to Import a Database With phpMyAdmin.
Step 4 - Update the Configuration File
If your database is required for your website to work properly, you will need to update the connection details in your website's configuration file.
The specific steps will vary depending on the type of content management system (CMS) you are using. However, in general, you will need to open the configuration file and update the database name, username, password, and host using the details of the new database.
Additional Resources
Check our selection of MySQL tutorials