以互联网上的源为yum源

[server]

name=server
baseurl=http://mirrors.163.com/centos/5/os/i386/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
 
 
把服务器上mysql.php部署到你自己的主机上并能够正常访问
#yum install httpd php php-mysql myspl mysql-server -y
# /etc/init.d/mysqld start
# mysql
mysql> create database school;
mysql> use school;
mysql> create table score (name char(20), chinese int, math int, english int);
mysql> insert into score values 
 
('zhangsan',77,88,99);
Query OK, 1 row affected (0.00 sec)
 
mysql> insert into score values 
 
('lisi',67,58,69);
Query OK, 1 row affected (0.00 sec)
 
mysql> insert into score values 
 
('wangwu',57,68,79);
Query OK, 1 row affected (0.00 sec)
 
 
# vim /var/www/html/mysql.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
        {
        die('Could not connect:' . mysql_error
 
());
        }
 
mysql_select_db("school", $con);
 
$result = mysql_query("SELECT * FROM score");
 
while($row = mysql_fetch_array($result))
        {
        echo $row['name'] . " " . $row
 
['chinese'] . " " . $row['math'] . " " . $row
 
['english'];
        echo "<br />";
        }
mysql_close($con);
?>
 
浏览器里输入http://127.0.0.1/mysql.php
 
 

yum源和mysql.php_yum