Skip to main content

Import and compress an SQL file

This guide explains how to import an SQL file into your FiveM database via phpMyAdmin.

Access phpMyAdmin

Log in to your game panel then access phpMyAdmin via the Databases tab.


Method 1: Copy-paste the SQL

This method works for small SQL files.

Steps

  1. Select your database in phpMyAdmin (left panel)
  2. Click on the SQL tab (right of "Structure")
  3. Open your .sql file with a text editor
  4. Select all (CTRL + A) and copy (CTRL + C)
  5. Paste into the white text area in phpMyAdmin
  6. Click Execute
File too large?

If you get an error, the SQL file is too large. Move to method 2.


Method 2: Import a file

This method is recommended for medium-sized files.

Steps

  1. In phpMyAdmin, select your database
  2. Click on the Import tab
  3. Click Choose File
  4. Select your .sql file
  5. Click Import at the bottom of the page
info

The size limit depends on server configuration. If the file is too large, move to method 3.


Method 3: Compress to ZIP

If your SQL file is too large, compress it to .zip before importing.

Compress with Windows 11

  1. Place your .sql file on the desktop or in a folder
  2. Right-click on the file
  3. Select Compress to ZIP file

Compress with WinRAR

  1. Right-click on the .sql file
  2. Select Add to archive...
  3. Choose ZIP format
  4. Click OK

Import the compressed file

  1. In phpMyAdmin, click on the Import tab
  2. Click Choose File
  3. Select your .zip file (not the .sql)
  4. Click Import at the bottom of the page
tip

phpMyAdmin will automatically decompress the ZIP file and import the SQL.


Other import methods

Via HeidiSQL (Windows)

  1. Download HeidiSQL
  2. Create a new connection with your credentials
  3. Select your database
  4. File > Run SQL file
  5. Select your .sql file

Via command line

mysql -h HOST -P PORT -u USERNAME -p DATABASE < file.sql

Common errors

ErrorSolution
File too largeCompress to ZIP
TimeoutSplit the file into multiple parts
Syntax errorCheck the SQL file format
Charset errorAdd SET NAMES utf8mb4; at the beginning

Charset error

If you have encoding issues, add this line at the beginning of your SQL file:

SET NAMES utf8mb4;

Backup

Always make a backup of your database before importing an SQL file!