一. 运行环境:
lnmp 或者lamp
phpmyadmin不同版本对php和mysql的版本有相对应的要求
具体可以去官网查看:https://www.phpmyadmin.net/files/
二. 安装
- 下载 :
https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.zip - 解压到web的根目录,并且重命名为phpmyadmin
unzip phpMyAdmin-4.8.3-all-languages.zip mv phpMyAdmin-4.8.3-all-languages phpmyadmin
- 复制配置文件
cd /var/www/html/phpmyadmin cp config.sample.inc.php config.inc.php
- http://192.168.4.55/phpmyadmin 访问登录测试
到此安装结束,接下来设置登录方式
三. 设置登录方式和管理多个数据库服务器
- 如何设置phpMyAdmin自动登录?
打开config.inc.php 找到 $cfg['Servers'][$i]['auth_type'],将$cfg['Servers'][$i]['auth_type'] = 'cookie';
改成$cfg['Servers'][$i]['auth_type'] = 'config'
然后在下面追加如下代码:$cfg['Servers'][$i]['user'] = 'root'; // 设置的mysql用户名 $cfg['Servers'][$i]['password'] = '123456'; // 设置的mysql密码
- 如何取消phpMyAdmin自动登录
只需把$cfg['Servers'][$i]['auth_type'] = 'config';
改成$cfg['Servers'][$i]['auth_type'] = 'cookie';
温馨提示:
$cfg['Servers'][$i]['auth_type'] 有三个待选项值,即 cookie、http、config。用的比较多的是 cookie与config。当在正式环境时,用 cookie,要求用户必须输入正确的用户名与密码,而在本地测试服务器时,一般用 config,省得session失效后又得输入用户名与密码,以节省开发时间
- 登陆phpMyAdmin时输入服务器ip地址端口、用户名、密码
只需要在phpmyadmin的配置文件 config.inc.php 中加上一个配置项$cfg['AllowArbitraryServer'] = true;
这样登录界面会多出服务器一项 不填的话默认使用配置文件中的服务器 指定端口只需在服务器地址后加一个空格再加上端口即可,是不是很简单呢^^ - 只需输入用户名、密码,服务器地址为下拉列表可选
修改config.inc.php文件,找到 First server 注释部分,将其修改为以下内容$hosts = array( '1'=>array('host'=>'localhost','user'=>'root','password'=>'123456'), '2'=>array('host'=>'192.168.0.1','user'=>'ciray','password'=>'123456') ); //$hosts数组下标从1开始,host的值为服务器ip地址,user是对应的MySql登陆用户名,password的值为MySql的登陆密码,请修改成你自己的 //$hosts数组配置了两台服务器,如果你有多台服务器,请按数组下标递增的顺序添加配置信息 /* * First server */ for($i=1;$i<=count($hosts);$i++){ /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = $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'] = $hosts[$i]['user']; //修改用户名 $cfg['Servers'][$i]['password'] = $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'; }
修改完成后保存文件,重新登陆,如果可以看到phpMyAdmin登陆界面中出现服务器候选列表,说明修改正确.
如需开启高级功能,参考:https://blog.csdn.net/joshua_317/article/details/51363471
大功告成,还可以监控mysql
转载于:https://blog.51cto.com/lingxudong/2326283