您的位置:首页 > 编程语言 > PHP开发

跟我学 phpmyadmin 管理MYSQL多台数据库

2012-02-28 16:14 267 查看
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;

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

$i++;

/* Authentication type */

/* Server parameters */

$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"];

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

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

[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 } ?>

<div class="item">

<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" />

</div>

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

[mysqld]

datadir=/var/lib/mysql

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

user=mysql

port=3306

[align=left] 登录到所需连接的数据库服务器192.168.20.204中 %也可以是安装了phpmyadmin的服务器IP地址192.168.20.206。\[/align]
[align=left] [/align]

[align=left]mysql>grant usage on *.* to 'benson'@'192.168.20.206' identified by '22362236';[/align]
[align=left]mysql> grant all privileges on *.* to 'benson'@'192.168.20.206' identified by '22362236';[/align]
[align=left]mysql>flush privileges;[/align]

[align=left]mysql>grant usage on *.* to benson@"%" identified by '22362236';[/align]
[align=left]mysql> grant all privileges on *.* to benson'@"%" identified by '22362236';[/align]
[align=left]mysql>flush privileges;[/align]
[align=left] [/align]
[align=left] [/align]




点执行





OK 现在 可以管理 远端MYSQL 服务器了
本文出自 “IT” 博客,请务必保留此出处http://benly.blog.51cto.com/460663/791866
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐