首先安装一下mysql数据库
[root@localhost ~]# yum install -y mysql-sever mysql-devel
启动mysql数据库
[root@localhost ~]# service mysqld restart
给mysql的root设置一个密码为123
[root@localhost ~]# mysqladmin -uroot password 123
进入mysql数据库
[root@localhost ~]# mysql -uroot -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.95 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zhanghan;
Query OK, 1 row affected (0.00 sec)
mysql> use zhanghan;
Database changed
mysql> create table edong(name char(25),pwd char(25),primary key(name));
Query OK, 0 rows affected (0.01 sec)
mysql> insert into edong(name,pwd) values('user01',ENCRYPT(111));
Query OK, 1 row affected (0.01 sec)
mysql> insert into edong(name,pwd) values('user02',ENCRYPT(111));
Query OK, 1 row affected (0.00 sec)
mysql> select * from edong;
+--------+---------------+
| name | pwd |
+--------+---------------+
| user01 | oLdqcSYvbXsu2 |
| user02 | .MquW8d0Wn.Xc |
+--------+---------------+
2 rows in set (0.00 sec)
我们在apache建立虚拟用户
[root@localhost ~]# cd /etc/httpd/conf.d/
[root@localhost conf.d]# vim virtual.conf