Home  >  Article  >  Database  >  CentOS 下MySQL 5.1.45 二进制版本安装及多Apache php版本安装

CentOS 下MySQL 5.1.45 二进制版本安装及多Apache php版本安装

WBOY
WBOYOriginal
2016-06-07 16:59:521071browse

1.下载二进制版本,现在很多网站都有相关的下载,大小大概117M左右,解压缩有大概384M 我下载的版本为:mysql-5.1.45-linux-i68

1.下载二进制版本,现在很多网站都有相关的下载,大小大概117M左右,解压缩有大概384M

  我下载的版本为:mysql-5.1.45-linux-i686-glibc23

2.从文件名看需要glibc2.3 版本。

 Shell>rpm -q glibc

3.把mysql-5.1.45-linux-i686-glibc23 复制到/usr/local/mysql 下;

4.把/usr/local/mysql 权限改为:chown mysql.mysql /usr/local/mysql

5.cd /usr/local/mysql/script

6.vi mysql_install_db 修改mysql 的目录和data创建的位置:

basedir="/usr/local/mysql/"
builddir=""
ldata="/usr/local/mysql/data" #生成的数据库的文件存放的位置

langdir="/usr/local/mysql/share"

7.修改完成后执行该脚本,创建数据库

8.修改data 权限:

   chown -R mysql.mysql /usr/local/mysql/data

9.my.cnf 文件的修改:

  cp /usr/local/mysql/support-files/my-medium.cnf /etc/my5.cnf

[client]
#password       = your_password
port            = 3308
socket          = /tmp/mysql5145.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3308
socket          = /tmp/mysql5145.sock

10.启动mysql:

/usr/local/mysql/bin/mysqld_safe --defaults-file='/etc/my5145.cnf' --user=mysql &

echo /usr/local/mysql/bin/mysqld_safe --defaults-file='/etc/my5145.cnf' --user=mysql & >> /etc/rc.local

这样开机的时候就可以启动mysql

10.完成。

编译安装多个apache:

 如果之前的apache 安装在/usr/local/apache 下。

现在就安装在/usr/local/apache2 下

1.mkdir /usr/local/apache2

2.开始编译:

./configure --prefix=/usr/local/apache2

3.make

4.make install

安装多个php版本:

先前的php4安装在/usr/local/php

现在安装php5(php-5.2.11)在/usr/local/php5

1.mkdir /usr/local/php5

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5/lib -enable-track-vars --enable-sockets --with-zlib

2.make && make install

3.cp php.ini-dist /usr/local/php5/lib/php.ini

4.编辑/usr/local/apache2/conf/httpd.conf

a修改默认的监听端口:

Listen 8080

b修改启动的用户和组

User

Group

c增加php的支持AddType

d修改主页搜索顺序

DirectoryIndex index.html index.php

e增加中文的默认语言的支持

DefaultCharset

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn