一,下載phpmyadmin
1,官網地址:
https://www.phpmyadmin.net/
2,下載:
liuhongdi@lhdpc:/usr/local/source$ mkdir phpmyadmin liuhongdi@lhdpc:/usr/local/source$ cd phpmyadmin/ liuhongdi@lhdpc:/usr/local/source/phpmyadmin$ wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.zip
說明:劉宏締的架構森林是一個專注架構的博客,地址:https://www.cnblogs.com/architectforest
對應的源碼可以訪問這里獲取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
說明:作者:劉宏締 郵箱: 371125307@qq.com
二,安裝phpmyadmin
1,解壓:
liuhongdi@lhdpc:/usr/local/source/phpmyadmin$ unzip phpMyAdmin-5.1.1-all-languages.zip
移動到站點目錄下:
root@lhdpc:/usr/local/source/phpmyadmin# mv phpMyAdmin-5.1.1-all-languages /var/www/html/phpmyadmin
2,站點的配置文件:
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass 127.0.0.1:9000; } }
三,配置phpmyadmin
1,從mysql控制台創建訪問127.0.0.1的賬號:
root@lhdpc:~# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.27-0ubuntu0.21.10.1 (Ubuntu) Copyright (c) 2000, 2021, 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> create user 'root'@'127.0.0.1' identified by 'rootpassword'; Query OK, 0 rows affected (0.02 sec) mysql> grant all on *.* to root@127.0.0.1; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
2,生成配置文件:
root@lhdpc:/var/www/html/phpmyadmin# cp config.sample.inc.php config.inc.php
修改內容:把host改為 127.0.0.1
如下:
//$cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['host'] = '127.0.0.1';
四,測試安裝效果:
訪問:
http://127.0.0.1/phpmyadmin/index.php
返回:

五,查看php及phpmyadmin的版本
1,查看php版本
root@lhdpc:~# /usr/local/soft/php8/bin/php --version PHP 8.1.1 (cli) (built: Dec 20 2021 16:12:16) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.1, Copyright (c) Zend Technologies with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
2,查看phpmyadmin的版本:

六,查看linux的版本:
root@lhdpc:/usr/local/source/phpmyadmin# cat /etc/os-release PRETTY_NAME="Ubuntu 21.10" NAME="Ubuntu" VERSION_ID="21.10" VERSION="21.10 (Impish Indri)" VERSION_CODENAME=impish ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=impish