RedFlag6+apache2:
我用的软件版本及安装后的位置:
mysql客户端安装位置: /usr/bin/mysql MySQL-client-5.0.22-0.i386.rpm
PHP安装位置: /usr/php-5.2.5RC1 php-5.2.6.tar.gz
mysql服务器: /usr/share/mysql MySQL-server-5.1.7-0.i386.rpm
apache: /home/www/apache httpd-2.2.9.tar.gz
下载MySQL-devel.XXX.rpm 进行安装,这种安装方法很容易,不会安装的查下资料就可以了
您可能用到的安装及应用过程出出现问题的解决方法:
***查看你的系统有没有安装mysql header
find / -name mysql.h***
安装mysql头后出现下面这个错误:
gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory
gcc: /usr/lib/mysql/libz.so: No such file or directory
解决方法:
删除 /usr/lib/mysql 下的所有.la文件
Deleting libmysqlclient.la and other .la files in the MySQL libraries directory
solves the problem.
显示mysql服务器和客户端的版本号:
rpm -qa|grep -i mysql
卸载mysql客户端和服务器端:
rpm -ev MySQL-server-5.1.7-0 MySQL-client-5.0.22-0
删除附加文件:
rm -f /etc/my.cnf //配置文件
rm -rf /var/lib/mysql //数据库文件
更改用户密码:
./mysqladmin -u root password '123'
连接带密码的mysql登陆:
>mysql -u root -p
>password: 123
***./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-charset=gbk***
创建数据库表:
create table testuser
(
userid int auto_increment primary key,
username char(20),
userpass char(20)
);
插入数据:
insert into testuser (username,userpass) values('guigui','guigui');
insert into testuser (username,userpass) values('admin','admin');
导出数据库:
cd /usr/bin
mysqldump -u root -p guigui >/root/Desktop/guigui.sql
导入数据库:
mysql -u root -p
password:123
mysql>create database testin;
mysql>use testin;
mysql>source /root/Desktop/guigui.sql
apache安装:
1,下载
2,解压 tar -vxzf httpd-2.2.9.tar.gz
3,配置 ./configure --prefix=/home/www/apache --enable-so --enable-mods-shared=most
4, make
make install
5,cd /home/www/apache/bin/
./apachectl start //启动apache 服务
6,打开浏览器输入127.0.0.1 或 http://localhost 出现 it works 说明安装成功
7,把程序用为系统服务使其自动运行
cp /usr/apache/bin/apachectl /etc/rc.d/init.d/httpd
卸载则删除 /home/sf/www/apache 中的所有内容
php的安装:
1,解压
2,./configure --with-apxs2=/home/www/apache/bin/apxs --prefix=/home/www/php --with-mysql=/var/lib/mysql/
./configure --with-apxs2=/home/www/apache/bin/apxs --prefix=/home/www/php --with-mysql=/usr/share/mysql 此句可以用
3,make
make install
4,cp php.ini-dist /usr/local/lib/php.ini
5,配置apache使其支持php
修改httpd.conf
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml
重启动计算机
注意:如果配置PHP安装的时候出现如下错误
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore.
是因为安装的Mysql没有头文件
解决方法:
./configure --with-apxs2=/home/www/apache/bin/apxs --prefix=/home/www/php --with-mysql=/var/lib/mysql/
Windows2003Server+Apache :操作比较容易因此说的不细请谅解
安装apache mysql 对数据库做准备
配置Apache 使其能引入php模块:
更改Apache配置文件httpd.conf如下
LoadModule php5_module "D:/php/php5apache2_2.dll" apache2应该调用此dll文件
PHPIniDir "D:/PHP"
AddType application/x-httpd-php .php
将libmysql.dll复制到 apache安装目录/bin目录下
重启动apache服务