linux(ubuntu 21.10): 安装phpmyadmin5.1.1 (php8.1.1)

一,下载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
原文地址:https://www.cnblogs.com/architectforest/p/15714441.html