mysql_connect("localhost","root","");
mysql_select_db("mysql");
mysql_query("delete from user where root!='root' and host!='localhost'");
mysql_query("set password for 'root'@'localhost' =password('$pwd')");
mysql_close();
mysql_connect("localhost","root",$pwd) or die("can't connect to mysql");
mysql_select_db("mysql");
mysql_query("delete from user where user!='root' or host!='localhost'");
$rs=mysql_query("select * from user");
echo "<table>";
while($t=mysql_fetch_array($rs,MYSQL_ASSOC)){
echo "<tr>";
while(list(,$v)=each($t))
echo "<td>$v</td>";
echo "</tr>";
}
echo "</table>";
?>