Skip to content

Instantly share code, notes, and snippets.

@evanre
Last active August 25, 2016 00:54
Show Gist options
  • Save evanre/a15c5baf336f2e6c3eb20eb94f2bdb8e to your computer and use it in GitHub Desktop.
Save evanre/a15c5baf336f2e6c3eb20eb94f2bdb8e to your computer and use it in GitHub Desktop.
Use this method, if you need site database, but you have access to site only via ftp (and no access to mysqlserver\phpmyadmin\cli). Copy file to site root, paste db acces info to string (delete double underscores), and open in browser http://site.com/sql-dump.php. Done. Warning! It's VERY unsafe to leave file on server. Make your dump and delete…
<?php
// Make dump of database via php
exec('mysqldump --user=__user_name__ --password=__user_pass__ --host=__host(localhost)__ __db_name__ > dump.sql');
print_r('Dump saved');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment