I got a mysql database "backup" that someone made and I have to use it, trying to get a website back online. Its a Joomla web database. The person gave me a file "database.txt" (not database.sql) which opens with Notepad. Trying to "import" in phpmyadmin does not work and just gives out errors like

" Ending quote ' was expected. (near "" at position 4438), and " 42 values were expected, but found 21. (near "(" at position 3967)

I'm attaching 2 screeshots here so that you guys can see the contents of this file,somewhere it says mysql dumping, making me feel that the file was created by mysqldump, but I wonder why it shows up as .txt and not .sql file.

Is there a way I can still get this database into my server (offline or online)? I will appreciate a guide or an online tutorial on how to accomplish this. I really do need the database.


Edited by savedlema: added attachments

Attachments dbexport-1.PNG 60.23 KB
1 Month
Discussion Span
Last Post by john_111

The screenshot starts by saying it is a phpmyadmin sql dump. Although we can't see the entire lines of code, it looks as if it is starting with the table definitions before the data itself is added. You will have to look for the create statements yourself to confirm this. you should also check for insert commands in the file.

So if it has been done correctly, all you need to do is change the name from database.txt to database.sql, and using phpmyadmin click on the import button, select your file and see what happens. Or copy and paste it into the sql query box in phpmyadmin. sometimes you get problems with file sizes however, and things run slow or grind to a halt.

To work successfully, the tables need to be created and populated in the correct order. IE if a table has three foreign keys it refers to, their tables must be created first so the foreign keys' source tables exist. You might have to run the import a couple of times if you get problems.

If you keep getting the errors, then sorry, but it's a bad dump file.

However it is much MUCH if you use a proper database backup plugin to create a backup of the site then restore it to the new site's server. That way any plugins and images are transfered as well.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.