GigaGlobe

Importing a Database via phpMyAdmin

55 views Database Management
<h3>Uploading SQL Files to Your Database</h3> <p>Importing a database is a common task when migrating a website from another server or restoring a backup. phpMyAdmin provides a straightforward import feature for SQL files.</p> <h3>Before You Begin</h3> <ul> <li>Ensure the target database already exists. If not, create it first through DirectAdmin's MySQL Management.</li> <li>If the database is not empty and you want a clean import, consider emptying it first or ensure your SQL file includes <code>DROP TABLE</code> statements.</li> <li>Check the size of your SQL file. phpMyAdmin has an upload limit (typically 50MB to 128MB depending on server configuration).</li> </ul> <h3>Step-by-Step Import</h3> <ol> <li>Log in to phpMyAdmin (via DirectAdmin).</li> <li>Select the target database from the left sidebar.</li> <li>Click the <strong>Import</strong> tab at the top of the page.</li> <li>Click <strong>Choose File</strong> (or <strong>Browse</strong>) and select your SQL file from your computer.</li> <li>Leave the format set to <strong>SQL</strong> (the default).</li> <li>Leave the character set as <strong>utf-8</strong> unless your database uses a different encoding.</li> <li>Click <strong>Go</strong> to start the import.</li> <li>Wait for the import to complete. You will see a success message listing the queries executed.</li> </ol> <div class="alert alert-warning">Do not close the browser tab or navigate away while the import is in progress. This will interrupt the process and may leave your database in an incomplete state.</div> <h3>Importing Large Files</h3> <p>If your SQL file exceeds the phpMyAdmin upload limit, try these alternatives:</p> <ul> <li><strong>Compress the file</strong> - phpMyAdmin can import compressed files in <code>.zip</code>, <code>.gz</code>, or <code>.bz2</code> format, which are significantly smaller.</li> <li><strong>Split the file</strong> - Use a tool like BigDump or SQLDumpSplitter to divide the SQL file into smaller parts and import them sequentially.</li> <li><strong>Use SSH</strong> - If you have SSH access, import via the command line: <pre><code>mysql -u username -p database_name &lt; /path/to/file.sql</code></pre></li> </ul> <h3>Common Import Errors</h3> <ul> <li><strong>Max execution time exceeded</strong> - The file is too large for the PHP timeout. Use SSH import or split the file.</li> <li><strong>Duplicate entry</strong> - The table already contains data with the same primary key. Empty the table first or use <code>INSERT IGNORE</code>.</li> <li><strong>Unknown collation</strong> - The SQL file uses a character collation not available on the server. Edit the file and replace the collation with <code>utf8mb4_general_ci</code>.</li> </ul> <div class="alert alert-info">After a successful import, verify the data by browsing the tables in phpMyAdmin and testing your website to ensure everything is working correctly.</div>
Need More Help?

Can't find what you're looking for? Our support team is ready to help.

Contact Support
Hi there! How can we help?