LAMP架构部署phpMyAdmin
1. 功能
phpMyAdmin 是一个用PHP编写的软件工具,可以通过web方式控制和操作MySQL数据库。通过phpMyAdmin 可以完全对数据库进行操作,例如建立、复制和删除数据等等。如果使用合适的工具,MySQL数据库的管理就会变得相当简单。应用 MySQL 命令行方式需要对 MySQL 知识非常熟悉,对SQL语言也是同样的道理。不仅如此,如果数据库的访问量很大,列表中数据的读取就会相当困难。
2. 特征
-
直观的网页界面
-
支持大多数 MySQL 功能:
-
- 浏览和删除数据库、表、视图、字段和索引
- 创建、复制、删除、重命名和更改数据库、表、字段和索引
- 维护服务器、数据库和表,以及有关服务器配置的建议
- 执行、编辑任何 SQL 语句并为其添加书签,甚至是批处理查询
- 管理MySQL用户帐户和权限
- 管理存储过程和触发器
-
从 CSV 和 SQL 导入数据
-
将数据导出为各种格式:CSV、SQL、XML、PDF、ISO/IEC 26300 - OpenDocument Text and Spreadsheet、Word、L一个TEX 及其他
-
管理多个服务器
-
以各种格式创建数据库布局的图形
-
使用逐例查询 (QBE) 创建复杂查询
-
在数据库或其子集中进行全局搜索
-
使用一组预定义的函数将存储的数据转换为任何格式,例如将 BLOB 数据显示为图像或下载链接
3. 环境需求
需要基于lamp已经构建完成的环境下进行部署。
phpmyadmin网址链接:www.phpmyadmin.net
4. 部署
//下载包
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip
--2022-08-04 09:57:22-- https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip
Resolving files.phpmyadmin.net (files.phpmyadmin.net)... 89.187.187.12, 2a02:6ea0:c800::6
Connecting to files.phpmyadmin.net (files.phpmyadmin.net)|89.187.187.12|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14112668 (13M) [application/zip]
Saving to: 'phpMyAdmin-5.2.0-all-languages.zip'
phpMyAdmin-5.2.0-al 100%[===================>] 13.46M 21.0KB/s in 4m 51s
2022-08-04 10:02:16 (47.4 KB/s) - 'phpMyAdmin-5.2.0-all-languages.zip' saved [14112668/14112668]
//解压包
[root@localhost src]# unzip phpMyAdmin-5.2.0-all-languages.zip
······
[root@localhost src]# ls phpMyAdmin-5.2.0-all-languages
CONTRIBUTING.md composer.lock libraries templates
ChangeLog config.sample.inc.php locale themes
LICENSE doc package.json url.php
README examples robots.txt vendor
RELEASE-DATE-5.2.0 favicon.ico setup yarn.lock
babel.config.json index.php show_config_errors.php
composer.json js sql
//导入所有文件
[root@localhost src]# rm -rf /usr/local/apache/htdocs/george/index.php
[root@localhost src]# mv phpMyAdmin-5.2.0-all-languages/* /usr/local/apache/htdocs/george/
//授权mysql
[root@localhost ~]# mysql -uroot -p123com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user,host from mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
3 rows in set (0.01 sec)
mysql> grant all on *.* to "root"@"%" identified by '123com';
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| root | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
4 rows in set (0.00 sec)
mysql> quit
Bye
[root@localhost ~]#
//重启服务
[root@localhost ~]# systemctl restart httpd.service
5. 测试
- 输入ip进行访问
- 输入用户名密码登入
- 创建一个名为george的数据库
[root@localhost ~]# mysql -uroot -p123com -e 'create database george;'
mysql: [Warning] Using a password on the command line interface can be insecure.
- 点击数据库页面进行刷新