您好,登錄后才能下訂單哦!
Phpmyadmin的使用首先需要lamp或者是lnmp環境:
一.首先搭建phpmyadmin運行環境
現在以lamp環境為例:
安裝部署lamp環境
1.安裝Apache
下載安裝
yum install zlib-devel -y
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gz
tar xf httpd-2.2.31.tar.gz
cd httpd-2.2.31
./configure \
--prefix=/application/apache2.2.31 \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite
make
make install
ln -s /application/apache2.2.31/ /application/apache
ls -l /application/
2、啟動服務
/application/apache/bin/apachectl start 啟動時會報錯,這時,在 vim httpd.conf文件中把98行改為 ServerName localhost:80,再次重啟就不再提示報錯了。
netstat -lntup|grep httpd
3、配置基于域名的虛擬主機
cd /application/apache/conf/
vim httpd.conf 修改98行
ServerName 127.0.0.1:80 這樣修改,第一次啟動時,就不提醒錯誤
4.php快速安裝
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum install freetype-devel libjpeg-turbo-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt libxslt-devel -y
yum install openssl-devel openssl -y
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
mkdir -p /application/tools
cd /application/tools
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ../
tar xf php-5.3.27.tar.gz
cd php-5.3.27
./configure \
--prefix=/application/php-5.3.27 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=mysqlnd \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv-dir=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--enable-gd-native-ttf \
--with-curl \
--with-xsl \
--enable-ftp \
--with-libxml-dir
make
make install
ln -s /application/php-5.3.27 /application/php
\cp /application/tools/php-5.3.27/php.ini-production /application/php/lib/php.ini
檢查apache配置文件中是否有
[root@web02 conf]# grep libphp5 /application/apache/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
[root@web02 conf]# ll /application/apache/modules/
total 28980
-rw-r--r--. 1 root root 9280 Oct 29 08:09 httpd.exp
-rwxr-xr-x. 1 root root 29660983 Oct 29 09:46 libphp5.so
二.配置httpd.conf:apache配置文件中針對連接php的設置
vim /application/apache/conf/httpd.conf
1)98 ServerName 127.0.0.1:80
2)311
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
3)用戶 (關鍵是統一UID,工作中web服務統一一套工具)
apache和nginx的用戶UID是一致的
67行下增加
User www
Group www
useradd www -s /sbin/nologin -M建立用戶:
id www
4)166
DirectoryIndex index.php index.html
此處的MySQL是:192.168.56.42,已經編譯安裝好
上傳phpMyAdmin-4.0.5-all-languages.tar.gz到/application/apache2.2.31/htdocs下
解壓 tar xf phpMyAdmin-4.0.5-all-languages.tar.gz
Mv phpMyAdmin-4.0.5-all-languages.tar.gz phpmyadmin 改名
到此部署完成
三.演示成果
在瀏覽器輸入:http://192.168.56.42/phpmyadmin/
此時的httpd的啟動用戶為www
[root@mysql-5 libraries]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 13442 root 4u IPv6 211012 0t0 TCP :http (LISTEN)
httpd 13444 www 4u IPv6 211012 0t0 TCP :http (LISTEN)
httpd 13445 www 4u IPv6 211012 0t0 TCP :http (LISTEN)
httpd 13446 www 4u IPv6 211012 0t0 TCP :http (LISTEN)
注意:
如果pkill httpd,
使用/etc/init.d/httpd start啟動,則會導致phpmyadmin界面打不開報錯404
此時查看lsof –i:80
[root@mysql-5 libraries]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 13381 root 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13383 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13384 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13385 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13386 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13387 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13388 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13389 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
httpd 13390 apache 4u IPv6 210479 0t0 TCP *:http (LISTEN)
在192.168.56.42服務器上的MySQL服務創建登陸phpmyadmin的用戶和密碼mysql> grant all on *.* to phpmyadmin@'192.168.56.%' identified by '123456';
修改配置文件:這樣就可以遠程登陸192.168.56.0/24網段的phpmyadmin的數據庫賬戶
/application/apache/htdocs/phpmyadmin/libraries/config.default.php
[root@mysql-5 libraries]# cat -n config.default.php|sed -n '746p'
746 $cfg['AllowArbitraryServer'] = true;
在MySQL服務器192.168.56.41上登錄數據庫操作:
mysql> select * from wjw02.t2;
+----+-------------+
| id | name |
+----+-------------+
| 1 | tomcat |
| 2 | fire |
| 4 | ball |
| 5 | tom |
| 6 | cat |
| 7 | gog |
| 8 | pig |
| 10 | tiger |
| 11 | go |
| 12 | booss |
| 13 | tomcat12 |
| 15 | tomcat1 |
| 17 | tomcat234 |
| 19 | tomcat34456 |
+----+-------------+
14 rows in set (0.01 sec)
mysql> select * from wjw01.t1;
+----+---------+
| id | name |
+----+---------+
| 1 |sansan |
| 2 | bobo |
| 3 | pig |
| 4 | apple |
| 5 | ball |
| 6 | peer |
| 7 | water |
| 9 | tomcat |
+----+---------+
8 rows in set (0.00 sec)
遠程登陸數據庫:
登陸遠程的192.168.56.41上的MySQL服務,查看當前的wjw02庫,t2表
192.168.56.41上登陸MySQL數據庫查看表數據:
mysql> select * from wjw02.t2;
+----+-------------+
| id | name |
+----+-------------+
| 1 | tomcat |
| 2 | fire |
| 4 | ball |
| 5 | tom |
| 6 | cat |
| 7 | gog |
| 8 | pig |
| 10 | tiger |
| 11 | go |
| 12 | booss |
| 13 | tomcat12 |
| 15 | tomcat1 |
| 17 | tomcat234 |
| 19 | tomcat34456 |
+----+-------------+
14 rows in set (0.00 sec)
四.報錯警告提示解決方法:
[root@mysql-5 libraries]# cat -n config.default.php|sed -n '160p'
160 $cfg['Servers'][$i]['extension'] = 'mysqli';
修改為:160 $cfg['Servers'][$i]['extension'] = 'mysql'
在配置文件102處添加短密碼123456,就不會在提示錯誤了:
root@mysql-5 libraries]# cat -n config.default.php|sed -n '102p'
102 $cfg['blowfish_secret'] = '123456';
五.解決缺少mcrypt擴展的問題的辦法
參考網友文檔:
http://blog.sina.com.cn/s/blog_4d0309640101ju0j.html
下面以CentOS 6.0系統為例來為說明
1、安裝第三方yum源(默認yum源里面沒有這幾個庫文件,不能使用yum安裝)執行以下命令
wget http://www.atomicorp.com/installers/atomic
執行以下命令
sh ./atomic
2、執行以下命令來安裝
yum install php-mcrypt libmcrypt libmcrypt-devel
3、重啟系統執行
shutdown -r now
記得還需重啟一下mysql ,大功告成 登陸phpmyadmin將不再出現缺少mcrypt擴展。請檢查PHP配置!
重新啟動Apache
/application/apache/bin/apachectl start
lsof -i:80
到此處問題解決
Phpmyadmin高級應用參考文檔
http://yongxi.blog.51cto.com/2352775/1762609
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。