• phpmyadmin连接,管理多个mysql服务器


    方法一,修改phpMyAdmin/libraries/config.default.php

    修改配置文件前,最好先备份一下,万一改错地方了,显示不了,就郁闷了。

    /**
     * allow login to any user entered server in cookie based authentication
     *
     * @global boolean $cfg['AllowArbitraryServer']
     */
    $cfg['AllowArbitraryServer'] = true; //默认是false,改成true

    修改前,服务器这个输入框是不存在的,变成true后就显示了,就可以连接多个不同的数据库了。但是这样修改有一个缺点,如果在多个数据库之间切换,要先退出,重新登录,这样挺烦人,看下面的这个方法。

    方法二,同时管理多个mysql服务器。

    1,将phpMyAdmin根目录下的config.sample.inc.php,重命名为config.inc.php

    2,修改config.inc.php文件

    /*
     * First server
     */
     //如果要管理,更多个mysql服务器,就修改$connect_hosts这个数组就行了
     $connect_hosts = array(
                '1'=>array(
                     "host"   => "localhost",  //服务器1
                     "user"   => "root",
                     "password" => ""
                     ),
                '2' => array(
                     "host"   => "192.168.0.11", //服务器2
                     "user"   => "wordpress",
                     "password" => "*******"
                     )
                );
    for ($i=1;$i<=count($connect_hosts);$i++) {
     /* Authentication type */
     $cfg['Servers'][$i]['auth_type'] = 'cookie';
     /* Server parameters */
     $cfg['Servers'][$i]['host'] = $connect_hosts[$i]['host'];   //修改host
     $cfg['Servers'][$i]['connect_type'] = 'tcp';
     $cfg['Servers'][$i]['compress'] = false;
     /* Select mysqli if your server has it */
     $cfg['Servers'][$i]['extension'] = 'mysql';
     $cfg['Servers'][$i]['AllowNoPassword'] = true;
     $cfg['Servers'][$i]['user'] = $connect_hosts[$i]['user'];  //修改用户名
     $cfg['Servers'][$i]['password'] = $connect_hosts[$i]['password']; //密码
     /* rajk - for blobstreaming */
     $cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
     $cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
     $cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
     $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
    }

    注意一点,数组下标不要从0开始,不然会提示错误的,无效的服务器索引:“0”

    登录前,

    phpmyadmin 修改config.inc.php 多服务器登录

    登录后,

    phpmyadmin 连接多个mysql服务器,登录后

    有一点要注意,用localhost登录后,选择上图下拉中的192.168.0.11后,还会让你登录,都登录后,在多个服务器这间切换就不要在登录了

  • 相关阅读:
    EOF输入
    2019春总结作业
    2019春第二次课程设计报告
    2019春第一次课程设计实验报告
    2019第一次作业的项目模块结构介绍
    2019春第十二周作业
    2019春第十一周作业
    2019春第十周作业
    2019春第九周作业
    2019春第八周作业
  • 原文地址:https://www.cnblogs.com/fonyer/p/3528724.html
Copyright © 2020-2023  润新知