欢迎阅读!

潇湘夜雨

当前位置: 主页 > 数据库 >

mysql管理工具

时间:2016-10-26 21:35来源:潇湘夜雨 作者:华嵩阳 点击:
mysql的管理和监控工具很多,例如percona-toolkit、navicat、monyog、phpadmin等工具 本文主要介绍phpadmin和percona-toolkit两个工具。 一、percona-toolkit percona-toolkit是一款适用于Linux系统管理mysql的命
mysql的管理和监控工具很多,例如percona-toolkit、navicat、monyog、phpadmin等工具
本文主要介绍phpadmin和percona-toolkit两个工具。
 
一、percona-toolkit
percona-toolkit是一款适用于Linux系统管理mysql的命令符工具,可以查看本地和远程mysql的详细运行参数。
配置步骤:
1.下载软件包
wget https://www.percona.com/downloads/percona-toolkit/2.2.19/RPM/percona-toolkit-2.2.19-1.noarch.rpm
2.安装
yum localinstall percona-toolkit-2.2.19-1.noarch.rpm  --nogpgcheck
注意:安装时需要解决依赖关系,通过yum本地安装自动解决依赖包。
3.命令使用
percona-toolkit的使用关键在于其命令的使用,下面介绍常用的几个命令。
pt-summary #查看本地数据库服务器的主要参数
pt-mysql-summary --user admin --password admin --host 172.18.109.235 #查看远程数据库的主要参数
 
二、phpadmin
 
phpadmin是一款php开发的集成数据管理和监控的工具,简单容易上手,而且新版本的功能越来越丰富。
 
安装配置配置步骤:
 
1.环境准备
lnmp或lamp环境
下载最新版phpadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.zip
解压软件包并复制到web服务器的根目录中
 
2.编辑配置文件
cp config.sample.inc.php config.inc.php #将样例配置为配置文件
修改配置文件:
phpadmin的认证方式有cookie、http、config三种模式,这里主要介绍后两种模式。
通常我们在企业中的数据库服务器有多个,每个数据库配一个phpadmin太麻烦,这介绍一下单个phpadmin管理多个mysql的配置方法。
1>http认证
http认证登录web界面需要数据库账号
这里只是更改认证的相关参数,其他参数不变。
phpadmin http认证多个服务器配置如下:
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '172.18.109.235';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
//slave1
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '172.18.109.236';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
 
//slave2
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '172.18.109.237';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
 
 
2>config认证多服务器配置
config认证不需要输入密码账号就可访问web界面,账户都保存在配置文件中,所以数据库的权限要设置低一些,防止数据库被随意修改。
/*
* master
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '172.18.109.235';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'admin';
$cfg['Servers'][$i]['password'] = 'admin';
$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';
 
/*
* slave1
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '172.18.109.236';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'admin';
$cfg['Servers'][$i]['password'] = 'admin';
$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';
 
/*
* slave2
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '172.18.109.237';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'admin';
$cfg['Servers'][$i]['password'] = 'admin';
$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';
 
3.浏览器访问测试
 
 
(责任编辑:liangzh)
织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
推荐内容