lamp搭建phpmyadmin
phpmyadmin简介
phpMyAdmin 是一个以php为基础,以Web-Base方式架构在网站主机上的MySQL的数据库管理工具,让管理者可用Web接口管理MySQL数据库。借由此Web接口可以成为易方式输入繁杂SQL语法的较佳途径,尤其要处理大量资料的汇入及汇出更为方便。其中一个更大的优势在于由于phpMyAdmin跟其他PHP程序一样在网页服务器上执行,但是您可以在任何地方使用这些程序产生的HTML页面,也就是于远端管理MySQL数据库,方便的建立、修改、删除数据库及资料表。也可借由phpMyAdmin建立常用的php语法,方便编写网页时所需要的sql语法正确性。
部署phpmyadmin
下载phpmyadmin并解压
[root@localhost ~]# cd /usr/src/
[root@localhost src]# ls
debug kernels mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
[root@localhost src]# wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip
--2022-08-04 09:22:07-- 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.19, 2a02:6ea0:c800::6
Connecting to files.phpmyadmin.net (files.phpmyadmin.net)|89.187.187.19|: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 100%[========>] 13.46M 116KB/s in 2m 0s
2022-08-04 09:24:13 (115 KB/s) - 'phpMyAdmin-5.2.0-all-languages.zip' saved [14112668/14112668]
[root@localhost src]# ls
debug mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
kernels phpMyAdmin-5.2.0-all-languages.zip
[root@localhost src]# unzip phpMyAdmin-5.2.0-all-languages.zip
[root@localhost src]# ls
debug
kernels
mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
phpMyAdmin-5.2.0-all-languages
phpMyAdmin-5.2.0-all-languages.zip
[root@localhost src]# ls phpMyAdmin-5.2.0-all-languages
CONTRIBUTING.md doc setup
ChangeLog examples show_config_errors.php
LICENSE favicon.ico sql
README index.php templates
RELEASE-DATE-5.2.0 js themes
babel.config.json libraries url.php
composer.json locale vendor
composer.lock package.json yarn.lock
config.sample.inc.php robots.txt
把php文件放到yyz中去
[root@localhost src]# cd /usr/local/apache/htdocs/yyz/
[root@localhost yyz]# ls
index.php
[root@localhost yyz]# rm -rf index.php
[root@localhost yyz]# mv /usr/src/phpMyAdmin-5.2.0-all-languages/* /usr/local/apache/htdocs/yyz/
[root@localhost yyz]# ls
CONTRIBUTING.md doc setup
ChangeLog examples show_config_errors.php
LICENSE favicon.ico sql
README index.php templates
RELEASE-DATE-5.2.0 js themes
babel.config.json libraries url.php
composer.json locale vendor
composer.lock package.json yarn.lock
config.sample.inc.php robots.txt
MySQL授权
[root@localhost ~]# mysql -uroot -pjiang123!
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 7
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
+---------------+-----------+
| user | host |
+---------------+-----------+
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
3 rows in set (0.00 sec)
mysql> grant all on *.* to "root"@"%" identified by 'jiang123!';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges; //刷新mysql
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> exit
Bye
[root@localhost ~]# systemctl restart httpd //重启httpd
测试