Resolved Can't export database

Status
Not open for further replies.

theengli

Member
Messages
104
Reaction score
1
Points
18
Hi,
I wanted to export my database and download it to my PC to create its backup before trying to upgrade my moodle website, but I can't.
My database is about 290 Mb, but only a small sql file gets downloaded, and it's empty. Is it because my database is too big? How can I download its backup? Or can perhaps an admin export it for me?
I'm afraid to make any significant changes without a database backup.
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
You can get it here (this is only for your server; other users have to choose their own server):

https://x13.x10hosting.com/phpMyAdmin/server_export.php?lang=en

Make sure to choose data and structure; if you do structure only, you'll get a small file. You have to increase the file size over 50k lines as well.

However, if this backup takes a long time, PHP will time out, or you will hit a resource limit. Consider dumping large tables individually instead of an entire DB.

If that doesn't work, I'll see if I can get an admin. Generally, they don't do this, but I can't speak for them.
 

theengli

Member
Messages
104
Reaction score
1
Points
18
You can get it here (this is only for your server; other users have to choose their own server):

https://x13.x10hosting.com/phpMyAdmin/server_export.php?lang=en

Make sure to choose data and structure; if you do structure only, you'll get a small file. You have to increase the file size over 50k lines as well.

However, if this backup takes a long time, PHP will time out, or you will hit a resource limit. Consider dumping large tables individually instead of an entire DB.

If that doesn't work, I'll see if I can get an admin. Generally, they don't do this, but I can't speak for them.
Hi,
I used your link and managed to download a gz file. Is it OK that it's only 8.8 Mb while my DB is about 290 MB? Or did it time out while downloading?
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
It probably timed out. Unless your database is literally the exact same data over and over again, it wouldn't compress down that far.
 

theengli

Member
Messages
104
Reaction score
1
Points
18
It probably timed out. Unless your database is literally the exact same data over and over again, it wouldn't compress down that far.
Is there any way to find out for sure? I can't proceed without a backup.
 

theengli

Member
Messages
104
Reaction score
1
Points
18
Maybe this would work better. You can change the PHP max execution time from DirectAdmin -> Extras -> PHP Version -> PHP Options and set it to something ridiculous. This script runs outside of DA, so it won't be affected by the system limits, only your set limits on the PHP Version page.

https://github.com/ttodua/useful-php-scripts/blob/master/my-sql-export (backup) database.php
Sorry for this absolutely idiotic question, but what do ppl do with such scripts? Do I need to copy and insert it somewhere in the DA panel? create some file with it and upload it to the hosting? somehow insert it somewhere on phpMyAdmin?
 

theengli

Member
Messages
104
Reaction score
1
Points
18

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
The instructions for the script are inside of it. It wants you to write a single line of code. Make a new file like this:

Code:
<?php
include('my-sql-export.php');

EXPORT_DATABASE("localhost","user","pass","db_name" );
?>

Save the file from the link to your computer and name it my-sql-export.php. Then upload it to your account inside of the public_html folder for your website. Create a new file in DA, call it backup.php, and put the above code in it. Then go to yoursite.example/backup.php.

Remove these files or password protect them immediately. Anyone who knows the file name can access your backups.
 
Status
Not open for further replies.
Top