2

centos上安装apache2+mysql5.0+php5


yum安装软件包:
yum install httpd php mysql mysql-server php-mysql

启动mysql
/etc/init.d/mysqld start

为root设置mysql的密码
mysqladmin -u root password ‘你要设置的密码’

用刚才设置的密码登陆
mysql -u root -p

显示数据库
mysql> show databases;

删除测试数据库
mysql> DROP DATABASE test;
Query OK, 0 rows affected (0.00 sec)

删除匿名用户
mysql> DELETE FROM mysql.user WHERE user = ”;
Query OK, 0 rows affected (0.00 sec)

刷新数据库
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

启动apache
/etc/init.d/httpd start

让重启或断电后,机器启动后自动开启http与mysql服务
/sbin/chkconfig httpd on
/sbin/chkconfig –add mysqld
/sbin/chkconfig mysqld on
/sbin/service httpd start
/sbin/service mysqld start

进到这个目录
[root@localhost html]# pwd
/var/www/html

web访问,测试看php能否看到信息.
[root@localhost html]# cat hi.php
php
phpinfo();
?>

[root@localhost html]# ls -lh
total 4.0K
-rw-r–r– 1 root root 20 Apr 23 03:24 hi.php

我猜~这些文章你可能也感兴趣

总共有2个留言:

  1. 西风 on 四 23rd, 2009 - 18:42

    我记得有一次我用lunarpages PHP版本互换 弄得我的论坛直接乱码了



    回复:我没用过耶…

  2. CG on 四 23rd, 2009 - 22:08

    貌似centOS上装跟redhat差不多,除了自己习惯使用的RPM



    回复:都是一样的啦CG

给我留言:

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word