VMware下Linux实现简单的LAMP实验

基于CentOS5.5版本

必须的套件有mysql,apache(httpd),mysql-server,php,php-devel,php-mysql,安装好套件后

1、httpd的设置(简单的修改一下启动即可,先是最基本的设置,虚拟主机什么的先不设置)

[root@client ~]# vi /etc/httpd/conf/httpd.conf (找到下边的那句话,加入index.php,意思就是可以搜索到.php的网页作为主业)
DirectoryIndex index.html index.html.var index.php
[root@client ~]# /etc/init.d/httpd restart
2、mysql的设置(建立一个数据库,然后在刚建立的数据库中添加一张表,并且插入内容)

[root@client ~]# /etc/init.d/mysqld restart
[root@client ~]# mysqladmin -u root password '721wyzj'(给root加入密码)

[root@client ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database bbs;

Query OK, 1 row affected (0.03 sec)
mysql> show databases;    
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bbs                |
| laji               |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.00 sec)

mysql> use bbs;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create table message(id int(10),title varchar(20),content varchar(200));


mysql> insert into message values('001','ethnicity','wethnicity');
mysql> select * from message;
+------+-----------+------------------+
| id   | title     | content          |
+------+-----------+------------------+
|    1 | ethnicity | wethnicity       |
+------+-----------+------------------+
1 rows in set (0.00 sec)
mysql> quit
Bye
保存退出

[root@client ~]# /etc/init.d/mysqld restart

相关推荐