phpMyAdmin给非技术人员一个查阅数据库的窗口
2022/12/14 4:23:59
本文主要是介绍phpMyAdmin给非技术人员一个查阅数据库的窗口,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
背景
管理数据库的界面工具。
开发团队中一般有非技术背景人员,比如: 产品,功能测试人员;
对他们来说,可能安装数据库管理工具客户端都很麻烦,需要一款在线的网页工具能方便他们查阅数据。
本地docker安装
单库:
docker run --name myadmin -d -e PMA_HOST=lifcHost -e PMA_PORT=3306 -e PMA_USER=root -e PMA_PASSWORD=Root1234 -p 9001:80 phpmyadmin
多库:
php初始化文件:
<?php $server_hosts = array( '1' => array('server_name' => 'lifcHost', 'host' => 'lifcHost', 'port' => 3306, 'user'=>'root', 'password' => 'Root1234'), '2' => array('server_name' => 'dev', 'host' => '10.10.1.23', 'port' => 30099,'user'=>'root', 'password' => 'Cycube123!'), '3' => array('server_name' => 'uat', 'host' => '10.10.1.23', 'port' => 30099,'user'=>'root', 'password' => 'Cycube123!') ); foreach($server_hosts as $key => $sh) { $cfg['Servers'][$key]['verbose'] = $sh['server_name']; $cfg['Servers'][$key]['auth_type'] = 'cookie'; $cfg['Servers'][$key]['host'] = $sh['host']; $cfg['Servers'][$key]['user'] = $sh['user']; $cfg['Servers'][$key]['port'] = $sh['port']; $cfg['Servers'][$key]['password'] = $sh['password']; $cfg['Servers'][$key]['connect_type'] = 'tcp'; $cfg['Servers'][$key]['compress'] = false; $cfg['Servers'][$key]['extension'] = 'mysqli'; $cfg['Servers'][$key]['AllowNoPassword'] = false; } $cfg['ServerDefault'] = 1;
docker run --name myadmin -p 9001:80 -v d:/test/phpMyAdmin/config/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php -d phpmyadmin
首页需要收入服务器的账号和密码。
k8s安装
--- apiVersion: v1 kind: ConfigMap metadata: name: configmap-phpmyadmin data: config.user.inc.php: |- <?php $server_hosts = array( '1' => array('server_name' => 'prod', 'host' => 'sh-cdb-l5xxx.com', 'port' => 59153, 'user'=>'cyxxxe_read', 'password' => 'xxxxx'), '2' => array('server_name' => 'dev', 'host' => '10.10.1.23', 'port' => 30099,'user'=>'root', 'password' => 'xxx123!') ); foreach($server_hosts as $key => $sh) { $cfg['Servers'][$key]['verbose'] = $sh['server_name']; $cfg['Servers'][$key]['auth_type'] = 'cookie'; $cfg['Servers'][$key]['host'] = $sh['host']; $cfg['Servers'][$key]['user'] = $sh['user']; $cfg['Servers'][$key]['port'] = $sh['port']; $cfg['Servers'][$key]['password'] = $sh['password']; $cfg['Servers'][$key]['connect_type'] = 'tcp'; $cfg['Servers'][$key]['compress'] = false; $cfg['Servers'][$key]['extension'] = 'mysqli'; $cfg['Servers'][$key]['AllowNoPassword'] = false; } $cfg['ServerDefault'] = 1; --- apiVersion: apps/v1 kind: Deployment metadata: name: phpmyadmin namespace: tp labels: cycube: phpmyadmin spec: replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: cycube: phpmyadmin template: metadata: labels: cycube: phpmyadmin spec: restartPolicy: Always schedulerName: default-scheduler dnsPolicy: ClusterFirst terminationGracePeriodSeconds: 120 imagePullSecrets: - name: ali-sh2-cycube-images containers: - image: phpmyadmin name: phpmyadmin imagePullPolicy: IfNotPresent volumeMounts: - name: phpmyadmin-volume mountPath: /etc/phpmyadmin/config.user.inc.php subPath: config.user.inc.php resources: limits: cpu: 250m memory: 512Mi requests: cpu: 125m memory: 256Mi ports: - name: http containerPort: 80 protocol: TCP livenessProbe: httpGet: path: / port: 80 scheme: HTTP initialDelaySeconds: 120 periodSeconds: 30 readinessProbe: httpGet: path: / port: 80 scheme: HTTP initialDelaySeconds: 90 timeoutSeconds: 15 periodSeconds: 30 successThreshold: 1 failureThreshold: 5 volumes: - name: phpmyadmin-volume configMap: name: configmap-phpmyadmin items: - key: config.user.inc.php path: config.user.inc.php --- apiVersion: v1 kind: Service metadata: name: svc-phpmyadmin-n spec: ports: - name: phpmyadmin-port port: 80 protocol: TCP targetPort: 80 nodePort: 30401 selector: cycube: phpmyadmin sessionAffinity: None type: NodePort
执行指令:
kubectl apply -f phpadmin.yml -n tp
即可进入:
小结
替代客户端的一个统一管理数据库的工具。 网页版本更清凉。
原创不易,关注诚可贵,转发价更高!转载请注明出处,让我们互通有无,共同进步,欢迎沟通交流。
这篇关于phpMyAdmin给非技术人员一个查阅数据库的窗口的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-11开源 PHP 商城项目 CRMEB 二次开发和部署教程
- 2024-11-09怎么使用php在kaufland平台刊登商品?-icode9专业技术文章分享
- 2024-11-05PHP的抽象类和接口是什么,有什么区别-icode9专业技术文章分享
- 2024-11-01开源 PHP 商城项目 CRMEB 安装和使用教程
- 2024-11-01用php和mysql写无限分类,有哪几种方法-icode9专业技术文章分享
- 2024-10-31php数据分表导出时部分数据无法导出什么原因-icode9专业技术文章分享
- 2024-10-30有经验的 PHP 开发者学习一门新的编程语言,有哪些推荐的有前景的语言-icode9专业技术文章分享
- 2024-10-21php 检测图片是否篡改过-icode9专业技术文章分享
- 2024-10-20fruitcake/php-cors 该怎么使用-icode9专业技术文章分享
- 2024-10-18PHP7.1可以使用哪个版本的swoole-icode9专业技术文章分享