简单LAMP的实现及测试
简单LAMP的实现LAMP是Linux Apache Mysql PHP 这四款自由软件首字母的缩写,这四款开源软件虽然不是专门设计用来一起工作的,但由于开源软件的低廉价格和表现出的不俗实力,越来越受到人们的青睐。随着开源潮流的蓬勃发展,LAMP已经与J2EE和在web应用程序市场形成鼎立之势。
废话不多说,下面介绍一下简单LAMP的具体实现过程:
Linux上的Mysql安装及配置
1. 给Mysql的数据目录创建单独的逻辑卷
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmkdir /mydata
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#创建存放数据的目录
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giffdisk /dev/sda
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#新建分区属性为8e
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifpvcreate /dev/sda5
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvgcreate myvg /dev/sda5
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giflvcreate –L 4G –n mylv myvg
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmke2fs –L MYDATA –j /dev/myvg/mylv
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/fstab
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifLABEL=MYDATA /mydata ext3 defaults 0 0
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#加入这一行实现开机自动挂载
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmount –a
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmkdir /mydata/data
2. 创建mysql用户
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifgroupadd –g 3306 mysql
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifuseradd –g 3306 –u 3306 –M –s /sbin/nologin
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifchown –R mysql:mysql /mydata
3. 解压mysql-5.5.15-linux2.6-i686.tar.gz,使用其中脚本进行初始化
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giftar xvf mysql-5.5.15-linux2.6-i686.tar.gz –C /usr/local/
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcd /usr/local
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifln –vs mysql-5.5.15-linux2.6-i686 mysql
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcd /usr/local/mysql
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifchown –R mysql:mysql ./*
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifscripts/mysql_install_db --user=mysql --datadir=/mydata/data
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#初始化Mysql用户和数据路径
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifchown –R root ./*
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#再将属主交还给root
4. 创建mysqld服务
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#导入服务脚本
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifchkconfig –add mysqld
5. 创建Mysql的配置文件
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/my.cnf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#找到下面的内容添加
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifdatadir= /mydata/data
6. 加入mysql命令
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/profile
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifPATH=$PATH:/usr/loca/mysql/bin
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#添加这一行
7. 加入mysql库文件的路径
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/ld.so.conf.d/mysql.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif/usr/local/mysql/lib
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#写入这一行
8. 设置头文件
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifln –vs /usr/local/mysql/include /usr/include/mysql
9. 添加man文件(如果你以后不想使用mysql的man文件不添加也是可以的)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/man.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifMANPATH /usr/local/mysql/man
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#添加这一行
service mysql start
#启动mysql服务
netstat –tnl
#查看3306端口处于监听状态,说明已经配置成功。
编译安装Apache
1.解压httpd-2.2.19.tar.bz2软件包
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giftar xvf httpd-2.2.19.tar.bz2
2. 设置安装规则、编译、安装
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable=ssl --enable-modules=most --enable-mods-share=most --enable-so
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmake
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmake install
3. 制作服务启动脚本
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/init.d/httpd
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#!/bin/bash
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif. /etc/rc.d/init.d/functions
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifif [ -f /etc/sysconfig/httpd ]; then
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif . /etc/sysconfig/httpd
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giffi
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifHTTPD_LANG=${HTTPD_LANG-"C"}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifINITLOG_ARGS=""
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifapachectl=/usr/local/apache/bin/apachectl
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifhttpd=${HTTPD-/usr/local/apache/bin/httpd}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#注意此上两行中路径要与你的安装路径一致
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifprog=httpd
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifpidfile=${PIDFILE-/var/run/httpd.pid}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giflockfile=${LOCKFILE-/var/lock/subsys/httpd}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifRETVAL=0
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifstart() {
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo -n $"Starting $prog: "
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif RETVAL=$?
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif [ $RETVAL = 0 ] && touch ${lockfile}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif return $RETVAL
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifstop() {
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo -n $"Stopping $prog: "
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif killproc -p ${pidfile} -d 10 $httpd
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif RETVAL=$?
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifreload() {
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo -n $"Reloading $prog: "
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif RETVAL=$?
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo $"not reloading due to configuration syntax error"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif failure $"not reloading $httpd due to configuration syntax error"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif else
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif killproc -p ${pidfile} $httpd -HUP
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif RETVAL=$?
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif fi
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcase "$1" in
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif start)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif start
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif stop)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif stop
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif status)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif status -p ${pidfile} $httpd
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif RETVAL=$?
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif restart)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif stop
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif start
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif condrestart)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif if [ -f ${pidfile} ] ; then
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif stop
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif start
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif fi
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif reload)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif reload
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif graceful|help|configtest|fullstatus)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif $apachectl $@
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif RETVAL=$?
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif ;;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif *)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif exit 1
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifesac
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifexit $RETVAL
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/httpd/httpd.conf
PidFile "/var/run/httpd.pid"
#添加这一行
chkconfig --add httpd
service httpd start
#启动httpd服务
netstat -tnl
#查看80端口处于监听状态,说明已经配置成功。
PHP的编译安装
1. 解压php-5.3.6.tar.bz2软件包
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giftar xvf php-5.3.6.tar.bz2
2. 设置安装选项、编译、安装
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif./configure --prefix=/usr/local/php5 --sysconfdir=/etc/php --enable-mbstring --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-libmcrypt --with-gd --with-mysqli
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmake
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmakeinstall
3. 加入命令路径
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/profile
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifPATH=$PATH:/usr/loca/php5/bin
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#添加这一行
4. 加入php库文件路径
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/ld.so.conf.d/php.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif/usr/local/php5/lib
5. 创建php配置文件
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcp php.ini-production /usr/local/php5/lib/php.ini
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#注意php.ini-production文件位于php-5.3.6.tar.bz2的解压目录
6.修改httpd服务配置文件使其支持php
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/httpd/httpd.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifAddType Application/x-httpd-php .php
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifAddType Application/x-httpd-php-source .phps
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#添加这两行在AddType xxxxxx行附近位置
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifDirectoryIndex index.php index.html
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#添加index.php
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifservice httpd restart
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#重启httpd服务
到此简单的LAMP就配置成功了
LAMP的测试
为了测试LAMP,作者在这里选用了
wordpress-3.0.4-zh_CN.zip
phpMyAdmin-3.4.3.2-all-languages.tar.bz2
要使这两个网站都能在新搭建的LAMP运行,就得虚拟主机来实现。
这里作者选用基于主机名的虚拟主机(基于ip的虚拟主机过于消耗ipv4资源;基于端口的虚拟主机只有一个主页能使用默认80端口)
使用于主机名的虚拟主机配置网站:
1. 配置虚拟主机
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/httpd/httpd.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#DocumentRoot "/usr/local/apache/htdocs"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#把此行注释
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifInclude /etc/httpd/extra/httpd-vhosts.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#把此行启用
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /etc/httpd/extra/httpd-vhosts.conf
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#添加内容
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif<VirtualHost *:80>
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifDocumentRoot "/web/phpmyadmin" #网站所在目录
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifServerName "phpmyadmin.redhat_hu.com" #虚拟主机名
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifErrorLog "logs/phpmyadmin.error" #错误日志
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifCustomLog "logs/phpmyadmin.access" combined #访问日志
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif</VirtualHost>
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif<Directory "/web/phpmyadmin">
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifOrder allow,deny
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifAllow from all
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif</Directory>
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#设置访问控制为允许所有
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif<VirtualHost *:80>
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifDocumentRoot "/web/wordpress"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifServerName "wordpress.redhat_hu.com"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifErrorLog "logs/wordpress.error"
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifCustomLog "logs/wordpress.access" combined
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif</VirtualHost>
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif<Directory "/web/wordpress">
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifOrder allow,deny
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifAllow from all
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif</Directory>
2.配置网站链接数据库
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmkdir /web/{phpmyadmin,wordpress}
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#创建网页所在目录 (此目录最好挂载逻辑卷,具体步骤见上文)
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.giftar xvf phpMyAdmin-3.4.3.2-all-languages.tar.bz2
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcp -R phpMyAdmin-3.4.3.2/* /web/phpmyadmin
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifunzip wordpress-3.0.4-zh_CN.zip
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifcp -R wordpress/* /web/ wordpress
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#将两个网站文件放入对应文件夹
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmv /web/wordpress/wp-config-simple.php /web/wordpress/wp-config.php
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifvim /web/wordpress/wp-config.php
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifdefine('DB_NAME', 'wordpress');
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifdefine('DB_USER', 'root');
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifdefine('DB_PASSWORD', 'redhat');
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#设置对应数据库名登录用户以及密码
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif在mysql中创建数据库
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmysql
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#未设置密码可以直接登录
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmysql>CREATE DATABASE wordpress;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmysql>SET PASSWORD FOR root@localhost=PASSWORD('redhat');
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmysql>FLUSH PRIVILEGES;
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gif#设置密码redhat
https://blog.51cto.com/evolution/p_w_picpaths/editer/InBlock.gifmysql>quit
全部配置完成
打开浏览器输入网址进行测试。
Ps:由于作者使用的是VMware虚拟机,C:\WINDOWS\system32\drivers\etc\hosts
中加入如下两行实现域名解析。
192.168.0.20 phpmyadmin.redhat_hu.com
192.168.0.20 wordpress.redhat_hu.com
页:
[1]