3

I want to export my database from phpMyAdmin to import it to another server. I go through the steps explained here and here but all I get is a 50kb .sql file that contains a list of errors in HTML. It starts with something like:

`<!DOCTYPE HTML><html lang='en' dir='ltr' class='chrome chrome71'><head><meta charset="utf-8" /><meta name="referrer" content="no-referrer" /><meta name="robots" content="noindex,nofollow" /><meta http-equiv="X-UA-Compatible" content="IE=Edge" /><style id="cfs-style">html{display: none;}</style><link rel="icon" href="favicon.ico" type="image/x-icon" /><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />`

For reference, here's a screenshot that shows I've checked "Data" and "Structure" for all tables.

enter image description here

I want to be able to export structure and data separately, if possible. I think this is because of a configuration issue but not sure what. I know an alternative is directly using mysql but I'm wondering what I'm doing wrong here.

Jorjani
  • 827
  • 1
  • 16
  • 31
  • 1
    Have you had a look at the file to see that it contains tables and data? You could test by loading it to another db as well. – P.Salmon Jan 14 '19 at 16:20
  • To add to @P.Salmon 's comment.. Does the PHPMyAdmin configured or logged user has the correct privileges for the MySQL databases/tables? You might want to use the root user account for the export. – Raymond Nijland Jan 14 '19 at 16:29
  • 1
    Thanks. Looks like the file I get is some kind of an error file but I'm not able to understand it properly. I am using a user that has all the rights but I'll try exporting with root. – Jorjani Jan 14 '19 at 16:32
  • Perhaps one of the suggestions here might help: https://stackoverflow.com/questions/36660299/phpmyadmin-export-database-gives-html-document-error-with-name-sql or here https://stackoverflow.com/questions/32770361/phpmyadmin-exports-html-not-sql or here https://stackoverflow.com/questions/34180442/phpmyadmin-gives-export-php-instead-of-database-sql-dump – JNevill Jan 14 '19 at 16:35
  • Thanks @JNevill. Seems to be a similar problem. I will try those. Should I delete the question if it's the same problem? – Jorjani Jan 14 '19 at 16:38
  • 1
    That's up to you. If this one goes unanswered it will probably just die a natural death. Perhaps keep it open until you find a resolution in one of those links, and if you find it (as an answer in an existing question) then upvote that answer and delete this question to keep the site clean. – JNevill Jan 14 '19 at 16:40

4 Answers4

2

This is very likely caused by a large database. There are two ways to work around it:

1- Change php.ini to allow large "max_input_vars". You need to restart your services for this to take effect.

2- Directly use mysql. You can use the answer provided here.

Jorjani
  • 827
  • 1
  • 16
  • 31
1

I too faced the same issue.

I solved the issue by exporting the tables separately and then the data separately.

While importing the data file,

a. add the below line at the top of the file SET FOREIGN_KEY_CHECKS = 0; b. add the below line at the bottom of the file SET FOREIGN_KEY_CHECKS = 1;

-1

This problem is related to very large size of database.

Go to your bin folder and type in cmd:

C:\xampp\mysql\bin>mysqldump -u root -p database_name_inPMA > anyDbName.sql

Enter password:your_password_here If you do not have the password use the command without -p

-2

I resolve problem like this when I:

Open phpMyAdmin and select the database you want to export. Click on the "Export" tab in the top menu. In the "Export Method" section, select "Custom - display all possible options". Scroll down and check the "Show result as text" option. Scroll down to the bottom of the page and click the "Go" button to export your database Then copy tekst (in my case it was something like 7000 lines) and paste it to file .sql

Bartek
  • 1