通过xampp访问外部mysql数据库

时间:2011-12-01 11:00:09

标签: mysql xampp

我有一个包含php和mysql的托管包,并且我已经在访问数据库并获取信息的服务器上安装了wordpress。我的网站按预期工作。

但是,我试图升级某些方面,但不想在我的网站的实时版本上尝试新的东西。

所以我想用xampp来测试我的网站,但是xampp不会连接外部数据库。

我假设它与php.ini或mysql配置有关,但我不知道如何允许它。

基本上我需要通过xampp访问我的托管服务提供商的mysql数据库!

有什么想法吗?

编辑:

xampp返回的警告信息是

Warning: Cannot modify header information - headers already sent by (output started at C:\Users\Alex Morley-Finch\Dropbox\Shared\Projects\htdocs\A3MediaFinal\templates\side.php:71) in C:\Users\Alex Morley-Finch\Dropbox\Shared\Projects\htdocs\A3MediaFinal\news\wp-includes\functions.php on line 3286

建立数据库连接时出错

第3286行:

    function dead_db() {
        global $wpdb;

        // Load custom DB error template, if present.
        if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
            require_once( WP_CONTENT_DIR . '/db-error.php' );
            die();
        }

        // If installing or in the admin, provide the verbose message.
        if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )
            wp_die($wpdb->error);

        // Otherwise, be terse.
        status_header( 500 );
        nocache_headers();
//3286  header( 'Content-Type: text/html; charset=utf-8' );
    }

1 个答案:

答案 0 :(得分:1)

您的网络托管服务提供商是否允许外部访问数据库。有些人不允许这样做,因为这是一个潜在的安全风险。

从现场网站获取数据库转储现在更好,并在进行更改时在本地运行吗?

注:

您收到的错误与正在输出的某些信息有关。线的内容是什么 wp-includes\functions.php on line 3286

当您在函数中打印某些值时,通常会出现此错误,然后尝试执行需要更改标题的操作,例如重定向。