部署phpmyadmin项目

部署phpmyadmin项目


//在搭建好lamp的基础上进行如下操作
//提前在(https://www.phpmyadmin.net/)网站上面把安装包进行

[root@lnh ~]# ss -antl  //查看一下端口号
State              Recv-Q             Send-Q                         Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  128                                127.0.0.1:9000                                0.0.0.0:*                                    
LISTEN             0                  128                                  0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  80                                         *:3306                                      *:*                                    
LISTEN             0                  128                                        *:80                                        *:*                                    
LISTEN             0                  128                                     [::]:22                                     [::]:*                                    
[root@lnh ~]# cd /usr/local/apache/htdocs/
[root@lnh htdocs]# ls
index.html  runtime
[root@lnh htdocs]# rz  //使用这个命令将下载好的包上传进来
[root@lnh htdocs]# ls
index.html  phpMyAdmin-5.2.0-all-languages.zip  runtime
[root@lnh htdocs]# mkdir phpMyAdmin  //创建位置存放目录
[root@lnh htdocs]# mv phpMyAdmin-5.2.0-all-languages.zip phpMyAdmin  
[root@lnh htdocs]# cd phpMyAdmin/
[root@lnh phpMyAdmin]# ls
phpMyAdmin-5.2.0-all-languages.zip
[root@lnh phpMyAdmin]# unzip phpMyAdmin-5.2.0-all-languages.zip//解压 
[root@lnh phpMyAdmin]# ls 
phpMyAdmin-5.2.0-all-languages  phpMyAdmin-5.2.0-all-languages.zip
[root@lnh phpMyAdmin]# mv phpMyAdmin-5.2.0-all-languages/* . 
//将里面的代码移动到当前目录
[root@lnh phpMyAdmin]# ls
babel.config.json  config.sample.inc.php  favicon.ico  LICENSE                         phpMyAdmin-5.2.0-all-languages.zip  setup                   themes
ChangeLog          CONTRIBUTING.md        index.php    locale                          README                              show_config_errors.php  url.php
composer.json      doc                    js           package.json                    RELEASE-DATE-5.2.0                  sql                     vendor
composer.lock      examples               libraries    phpMyAdmin-5.2.0-all-languages  robots.txt                          templates               yarn.lock
[root@lnh phpMyAdmin]# mv config.sample.inc.php config.inc.php
//修改config.sample.inc.php为config.inc.php
[root@lnh phpMyAdmin]# ls
babel.config.json  config.inc.php   favicon.ico  LICENSE                         phpMyAdmin-5.2.0-all-languages.zip  setup                   themes
ChangeLog          CONTRIBUTING.md  index.php    locale                          README                              show_config_errors.php  url.php
composer.json      doc              js           package.json                    RELEASE-DATE-5.2.0                  sql                     vendor
composer.lock      examples         libraries    phpMyAdmin-5.2.0-all-languages  robots.txt                          templates               yarn.lock
[root@lnh phpMyAdmin]# cd ..
[root@lnh htdocs]# cd /usr/local/apache/conf/extra/
[root@lnh extra]# ls
httpd-autoindex.conf  httpd-default.conf  httpd-languages.conf  httpd-mpm.conf                 httpd-ssl.conf      httpd-vhosts.conf
httpd-dav.conf        httpd-info.conf     httpd-manual.conf     httpd-multilang-errordoc.conf  httpd-userdir.conf  proxy-html.conf
[root@lnh extra]# vim httpd-vhosts.conf   //在之前lamp虚拟主机配置里面再添加以下配置
<VirtualHost *:80>      
    DocumentRoot "/usr/local/apache/htdocs/phpMyAdmin"
    ServerName phpMyAdmin.example.com
    ErrorLog "logs/phpMyAdmin.example.com-error_log"
    CustomLog "logs/phpMyAdmin.example.com-access_log" common
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/phpMyAdmin/$1
    <Directory "/usr/local/apache/htdocs/phpMyAdmin">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>
[root@lnh extra]# systemctl restart httpd.service 

//在我的电脑C:\Windows\System32\drivers\etc里面的hosts文件里面添加
192.168.222.250 phpMyAdmin.example.com进行映射
访问:phpMyAdmin.example.com

//输入自己mysql数据库的用户和密码进行登录


创建lnh库,tushanbu表,然后插入数据

在数据库里面进行查看

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| lnh                |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> use lnh;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from tushanbu;
+------+-----------+-----+-----+
| id   | name      | sex | age |
+------+-----------+-----+-----+
|    1 | zhangshan |   1 |  20 |
|    2 | suzhen    |   0 |  19 |
+------+-----------+-----+-----+
2 rows in set (0.00 sec)
//创建成功
posted @ 2022-08-04 00:51  涂山小布  阅读(274)  评论(0)    收藏  举报