انتقل إلى المحتوى

الدروس cPanel مبتدئ1 دقائق قراءة

How to Import and Export a MySQL Database with phpMyAdmin

Back up a database to a .sql file and restore it with phpMyAdmin in cPanel, plus what to do when the import is too large or times out.

بواسطة فريق تحرير ZSOLNET آخر تحديث

هذه الصفحة غير متاحة بالعربية بعد، لذا تُعرض بالإنجليزية.

أهم النقاط

  • Export creates a .sql file you can keep as a backup or move to another server.
  • Import into an empty database to avoid duplicate-table errors.
  • Large databases import more reliably over SSH.

Export a database

  1. In cPanel, open Databases → phpMyAdmin.
  2. Select the database in the left sidebar.
  3. Click the Export tab.
  4. Choose Quick and format SQL for a complete export. Choose Custom if you want compression or to add DROP TABLE statements.
  5. Click Export and save the .sql file.

Import a database

  1. Create an empty database and user in MySQL Databases if you don’t have one, and give the user all privileges on it.
  2. In phpMyAdmin, select the empty database.
  3. Click Import, choose your .sql or .sql.gz file and click Import.
  4. A green success message lists how many queries ran.

Large databases: use SSH

# export
mysqldump -u dbuser -p dbname | gzip > dbname.sql.gz
# import
gunzip < dbname.sql.gz | mysql -u dbuser -p dbname

After moving a WordPress database

Update DB_NAME, DB_USER and DB_PASSWORD in wp-config.php. If the domain changed too, run a search-and-replace on the old URL — see the guide to moving WordPress to a new domain.

الأسئلة الشائعة

My import fails with a size error. What can I do?

Compress the file as .sql.gz (phpMyAdmin accepts it), raise the PHP upload limit, or import over SSH with the mysql command, which has no upload limit.

I get 'Table already exists'.

The target database isn't empty. Drop the existing tables first (after making sure you don't need them), or tick 'Add DROP TABLE' when exporting.

شارك X LinkedIn Facebook

الدخول إلى حسابك

أدِر نطاقاتك واستضافتك وفواتيرك من مكان واحد.

اتصال آمن مباشرة مع منطقة العملاء في ZSOLNET.

افتح لوحة تحكم ZSOLNET

ليس لديك حساب؟