dyw_tbl。
[root@kvm8 html]# mysql -uroot -p123qwe Welcome to the MySQL monitor. Commands end with ; or \g. ............... mysql> use dyw; 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> drop table dyw_tbl; Query OK, 0 rows affected (0.09 sec) mysql> exit Bye
[root@kvm8 html]# mysql -uroot -p123qwe -e "use dyw; show tables;"
mysql_query 刪除資料庫 dywphp 中的資料表 dywphp_tbl。
[root@kvm8 html]# vim droptbl.php
[root@kvm8 html]# cat droptbl.php
<html>
<head>
<title>Deleting MySQL Tables</title>
</head>
<body>
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '123qwe';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = "DROP TABLE dywphp_tbl";
mysql_select_db( 'dywphp' );
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not delete table: ' . mysql_error());
}
echo "Table deleted successfully\n";
mysql_close($conn);
?>
</body>
</html>
dywphp_tbl,使用瀏覽器開啟 droptbl.php 也可以。
[root@kvm8 html]# php droptbl.php <html> <head> <title>Creating MySQL Tables</title> </head> <body> Connected successfully<br />Table deleted successfully </body> </html>
[root@kvm8 html]# mysql -uroot -p123qwe -e "use dywphp; show tables;"