I had a hosting account with godaddy and it got compromised by someone who had access to a scanned image of my drivers license. Godaddy would not do anything to help me. Someone stole my identity and they said "It is your responsibility to keep up with your own information". So I had to create a new account and cancel the old one, but I can not access the database through phpmyadmin. The dynamic webpages still connect to the old hostname and pull information. I have tried using mysql_dump, and it seems that they block access to it. Through different boards, I have come up with the following code to try and export, or back up all of the tables. It doesn't work, someone please help!

$hostname = "db.hostedresource.com";
$database = "db_name";
$username = "db_name";
$password = "password";
$conn = mysql_connect($hostname, $username, $password);
if (!$conn){
die('Could Not Connect: '.mysql_error());
}
echo 'Connected Successfully';

mysql_select_db($database);
$backupFile = 'file.sql';
$table = 'table';
$query = ("SELECT * INTO OUTFILE '$backupFile' FROM $table");
$result = mysql_query($query);
mysql_close($conn
)

I get a connected successfully, but no output file.

    i don't know if its good for you, but i had to make a very simple dump creator.

    http://phpcode.hu/teszt/dump_maker/?

    Once you can enter into you cpanel, you should see if one click backup/restore is available on your host.

      Call me a dumb A$? but how am I supposed to use it?

        you have to fill the table name and field names,
        then it creates a dump_X_table.php from your entire table.
        This code cannot create the table create SQL dump! Just the inserts.

          Need to backup sql database with no phpmyadmin access

          I did some research. For mysql database dumpers scripts.

          I found an excellent nice php script.
          You just upload it to your website.
          It uses .htaccess + .htpasswd for secure login

          This very easy to install and use script, not only can dump backup mysql
          but also you can browse and edit rows, fields in you MySQL database.
          So, it is an DB Editor as well. And run SQL, too.

          MySQLDumper is nice layout and modern.
          I prefer it to phpMyAdmin, which is a bit old and messy in compare ...

          Screenshot:
          http://www.mysqldumper.net/img/screenshots/home/home1.gif
          YouTube Video:
          http://www.youtube.com/watch?v=ymjO8OG7RKc

          I can really recommend: MySQLDumper
          http://www.mysqldumper.net/

            Your original approach might work if you get your permissions set correctly. The webserver will need permission to write the contents of $backupFile. You should be checking for success/failure of your mysql statements in your code and also reporting any errors to see what the problem is.

              MysqlDump worked perfectly! Thank you so much halojoy!

                Write a Reply...