phpmyadmin+mysql-5.6.16.tar.gz使用
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
新闻名称:phpmyadmin+mysql-5.6.16.tar.gz使用
文章源于:http://azwzsj.com/article/popicc.html