Method 1: Check the data table through PhpMyAdmin and delete it manually
This is a traditional method, manually check and delete:
Log in to PhpMyAdmin, select your mysql database name and enter "Click Structure" to select the data table you want to delete
Move to the bottom and enter "Selected Items" Select Delete to perform the table deletion operation. As shown below:
#This method is purely manual, more reliable and visible. However, it is relatively slow. For example, Phpcms v9 will have more than 100 headers. You need to be careful when checking, so the purpose of batching cannot be achieved.
Method 2: Batch deletion through database statements.
Before using this method, it is strongly recommended to back up the entire database. As for how to back up? Wouldn't you? Leave a comment below this article.
Specific method: Copy the following PHP execution statement, save it as a sql.php file (pay attention to configuring the database name, password, and data header), upload it to the website and directory through FTP, and run it.
<?php //设置数据库连接信息。数据库服务器地址,数据库用户名,数据密码 mysql_connect('localhost','root','123456'); //设置查询的数据库名称,比如CMSYOU当前设置的是phpcms mysql_select_db('phpcms'); $rs=mysql_query('show tables'); while($arr=mysql_fetch_array($rs)) { //设置要批量删除的数据库表前缀,如:v9_ $TF=strpos($arr[0],'v9_'); if($TF===0){ $FT=mysql_query("drop table $arr[0]"); if($FT){ echo "$arr[0] 删除成功!<br>"; } } } ?>
Recommended learning: phpmyadmin tutorial
The above is the detailed content of How to clear phpmyadmin database. For more information, please follow other related articles on the PHP Chinese website!