myql
yum install -y ncurses-devel
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin
tar zxvf mysql-5.1.72.tar.gz
cd mysql-5.1.72
vim x.log
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
cat x.log | bash
make && make install
mke -j 4 4核心
ln -s /application/mysql5.1.72/ /application/mysql
配置文件
mysql-5.1.72/support-files/
# cp my-small.cnf.sh /etc/my.cnf
# mkdir -p /application/mysql/data
# chown -R mysql.mysql /application/mysql/
# /application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql 初始化
# cp /lamp/mysql-5.1.72/support-files/mysql.server /etc/init.d/mysqld 启动脚本
# chkconfig --add mysqld
# chkconfig mysqld on
# chmod +x /etc/init.d/mysqld
# /etc/init.d/mysqld start
# /application/mysql/bin/mysqld_safe & 启动服务
/application/mysql/bin/mysql 启动MySQL
vim /etc/profile 修改path
PATH=" /application/mysql/bin:$PATH"
. /etc/profile 生效
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
# /application/mysql/bin/mysqladmin -u root password ‘123456‘
# mysql -u root -p
Enter password:
# /application/mysql/bin/mysqladmin -u root -p123456 password 123123
mysql> select user,host from mysql.user;
drop user "root"@kaoshi.com;
mysql> flush privileges; 刷新权限
php
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
yum install -y libxslt libxslt-devel libxml2 libxml2-devel
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ../
=============================
./configure \
--prefix=/application/php5.3.27 \
--with-apxs2=/application/apache/bin/apxs \ 加载PHP模块
--with-mysql=/application/mysql \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/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
Thank you for using PHP.
# make && make install
# ln -s /application/php5.3.27/ /application/php
# ll /application/apache/modules/
-rw-r--r-- 1 root root 9115 4月 19 12:33 httpd.exp
-rwxr-xr-x 1 root root 29540885 4月 20 08:53 libphp5.so
# grep libphp5 /application/apache/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
# ls php.ini-*
php.ini-development php.ini-production
# diff `ls php.ini-*` 对比
# cp php.ini-production /application/php/lib/php.ini 配置文件
vi /application/apache/conf/httpd.conf
ServerName 127.0.0.1:80 100行
AddType application/x-httpd-php .php .phtml 311行
AddType application/x-httpd-php-source .phps
User www 65行
Group www
<IfModule dir_module>
DirectoryIndex index.php index.html 168行
</IfModule>
# groupadd www
# useradd -s /sbin/nologin -M -g www www
# /application/apache/bin/apachectl restart
# vi hequan.php
<?php
phpinfo();
?>
vim index.php 测试数据库
<?php
//$link_id=mysql_connect(‘主机名‘,‘用户‘,‘密码‘);
$link_id=mysql_connect(‘localhost‘,‘root‘,‘oldboy123‘) or mysql_error();
if($link_id){
echo "mysql successful by oldboy !";
}else{
echo mysql_error();
}
?>
原文地址:http://hequan.blog.51cto.com/5701886/1765665