天天看點

跟我學 phpmyadmin 管理MYSQL多台資料庫

root@mail1 ~]# tar zxvf phpMyAdmin-3.4.10.1-all-languages.tar.gz

[root@mail1 ~]# cp phpMyAdmin-3.4.10.1-all-languages /usr/local/apache/htdocs/phpMyAdmin

[root@mail1 ~]# cd /usr/local/apache/htdocs/phpMyAdmin/

[root@mail1 phpMyAdmin]# cp config.sample.inc.php config.inc.php

$i++;

/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'cookie';

/* Server parameters */

$cfg['Servers'][$i]['host'] = 'localhost';

#/$cfg['Servers'][$i]['host'] = '192.168.20.204';

$cfg['Servers'][$i]['port'] = '3306';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

/* Select mysql if your server does not have mysqli */

$cfg['Servers'][$i]['extension'] = 'mysqli';

$cfg['Servers'][$i]['AllowNoPassword'] = false;

################################################

$cfg['Servers'][$i]['host'] = '192.168.20.204';         ------------管理多台MYSQL

[root@mail1 phpMyAdmin]# vi libraries/config.default.php

$cfg['blowfish_secret'] = 'BensonHan';

$cfg['Servers'][$i]['host'] = $_COOKIE["mysqlhost"];

[root@mail1 phpMyAdmin]# vi libraries/auth/cookie.auth.lib.php

<!-- Login form -->

<form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top" class="login">

    <fieldset>

    <legend>

<?php

    echo __('Log in');

    echo '<a href="./Documentation.html" target="documentation" ' .

        'title="' . __('phpMyAdmin documentation') . '">';

    if ($GLOBALS['cfg']['ReplaceHelpImg']) {

        echo '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('phpMyAdmin documentation') . '" />';

    } else {

        echo '(*)';

    }

    echo '</a>';

?>

</legend>

<?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?>

        <div class="item">

            <label for="input_servername" title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?>"><?php echo __('Server:'); ?></label>

            <input type="text" name="pma_servername" id="input_servername" value="<?php echo htmlspecialchars($default_server); ?>" size="24" class="textfield" title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?>" />

        </div>

<?php } ?>

    <label for="input_username">Server Address:</label>

    <input type="text" name="mysqlhost" id="mysqlhost" value="<?=$_COOKIE["mysqlhost"];?>" size="24" class="textfield" />

</div>

<div class="item">

    <label for="input_username">MySQL Port:</label>

    <input type="text" name="mysqlport" id="mysqlport" value="<?=$_COOKIE["mysqlport"];?>" size="24" class="textfield" />

在需要管理的MYSQL服務品上看一下/etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

port=3306

   登入到所需連接配接的資料庫伺服器192.168.20.204中   %也可以是安裝了phpmyadmin的伺服器IP位址192.168.20.206。\

mysql>grant usage on *.* to 'benson'@'192.168.20.206' identified by '22362236';

mysql> grant all privileges on *.* to 'benson'@'192.168.20.206' identified by '22362236';

mysql>flush privileges;

mysql>grant usage on *.* to benson@"%" identified by '22362236';

mysql> grant all privileges on *.* to benson'@"%" identified by '22362236';

跟我學 phpmyadmin 管理MYSQL多台資料庫

點執行