douxian9943 2014-08-03 12:58
浏览 74
已采纳

mysqldump-php无法使用共享的托管公司数据库。 没有命令行访问权限或SUPER权限

Does anyone know if mysqldump-php can work with shared hosting? I can get it to work on my local computer (I can get mysqldump to work locally also) but I need a method to backup a database that's hosted with a popular webhosting company. The only method that they offer to their customers is to sign onto phpMyAdmin and download your .sql manually. daily. yourself. no automation allowed. I'm a newbie and I'm going nuts trying to find a solution.

mysqldump-php called for

namespace Ifsnop\Mysqldump;

use Exception;
use PDO;
use PDOException;

It didn't mention needing command line access or SUPER privilege(s).

Am I using incorrect settings?

Here's the link to the code that I'm using on Github.

https://github.com/ifsnop/mysqldump-php#dump-settings

Any help would be so appreciated!

  • 写回答

1条回答 默认 最新

  • douju1968 2014-08-03 13:16
    关注

    I've had a look in the code of ifsnop, and it uses SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ before starting the transaction. Global settings are only allowed with the SUPER-privilege (which you don't have on a shared environment, with a good reason ;) ).

    You can either:

    1. If you have only MyISAM-tables, there is no need for a transaction, so it can be turned off in the config.

      $dumpConfig = array( 'single-transaction' => false ); $md = new Mysqldump($db, $user, $pass, $host, 'mysql', $dumpConfig);

    2. or; Change that word GLOBAL into SESSION (thus modifying the downloaded code).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?