//源码编译安装mysql:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &
安装成功会看到类似
[1] 3879
[root--1014--/usr/local/mysql]Starting mysqld daemon with databases from /usr/local/mysql/var
这样的提示信息
也可以通过ps -A | grep mysql查看mysql是否已经后台运行判断是否成功,当然在/usr/local/mysql/bin
目录下键入mysql后进入
mysql> 也表示mysql成功安装。
为了在shell下进行数据库操作直接输入命令就可以,不用进入/usr/local/mysql/bin/目录,建议建立如下链接:
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
ln -s /usr/local/mysql/bin/mysql /usr/bin
另外,通过编译源码安装的mysql每次电脑重启后需要自己重新手动启动mysql,为此有必要将mysql加入服务和
启动项,如下:
mv share/mysql/mysql.server /etc/init.d/mysql
chmod 775 /etc/init.d/mysql
chkconfig --add mysql
(小注备忘:775表示rwx rwx r-x,因为r--4,w--2,x--1)
///源码安装apache
shell>./configure --prefix=/usr/local/apache
shell>make
shell>make install
//
ln -s /usr/local/apache/bin/apachectl /usr/bin/
启动:
shell>apachectl start
测试:键入127.0.0.1能看到It Works表明apache安装成功
//源码安装php
shell>./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
shell>make
shell>make install
shell>cp php.ini-dist /usr/local/lib/php.ini
php和apache的整合
打开/usr/local/apache/conf/httpd.conf
对apache做如下配置
#设置站点跟目录
DocumentRoot "/home/httpd/html/" #自己设置
(注意:修改默认设置后,其下方的
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
中的“Deny from all”改为“Allow from all”,否则访问测试页面会出现forbidden错误
并且修改
<Directory "/xxx">中的“/xxx"修改为之前设置的DocumentRoot)
#设置是否允许索引目录
Options FollowSymLinks MultiViews
#设置php文件后缀
AddType application/x-httpd-php .php .phtml .php3 .inc
AddType application/x-httpd-php-source .phps
#设置apache的默认文件名次序
DirectoryIndex index.php index.shtml index.html index.htm
shell>apachectl restart
///测试
写个简单的php文件
http://127.0.0.1/xx.php
///phpMyAdmin安装
源码解压后直接放到DocumentRoot下
配置可能需要用到的命令
cd phpMyAdmin
mkdir config # create directory for saving
chmod o+rw config # give it world writable permissions
cp config.inc.php config/ # copy current configuration for editing
chmod o+w config/config.inc.php # give it world writable permissions
进入http://xxx/phpMyAdmin/scripts/setup.php可以可视化的进行配置
置过程中搞了很长时间还是每次进入http://xxx/phpMyAdmin时提示
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
错误,可以地址http://xxx/phpMyAdmin/index.php进入则正常,没搞明白怎么回事