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
- Select your database in phpMyAdmin (left panel)
- Click on the SQL tab (right of "Structure")
- Open your
.sqlfile with a text editor - Select all (CTRL + A) and copy (CTRL + C)
- Paste into the white text area in phpMyAdmin
- 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
- In phpMyAdmin, select your database
- Click on the Import tab
- Click Choose File
- Select your
.sqlfile - 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
- Place your
.sqlfile on the desktop or in a folder - Right-click on the file
- Select Compress to ZIP file
Compress with WinRAR
- Right-click on the
.sqlfile - Select Add to archive...
- Choose ZIP format
- Click OK
Import the compressed file
- In phpMyAdmin, click on the Import tab
- Click Choose File
- Select your
.zipfile (not the .sql) - 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)
- Download HeidiSQL
- Create a new connection with your credentials
- Select your database
- File > Run SQL file
- Select your
.sqlfile
Via command line
mysql -h HOST -P PORT -u USERNAME -p DATABASE < file.sql
Common errors
| Error | Solution |
|---|---|
| File too large | Compress to ZIP |
| Timeout | Split the file into multiple parts |
| Syntax error | Check the SQL file format |
| Charset error | Add 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!