Home > Database > phpMyAdmin > body text

How to clear phpmyadmin database

Release: 2019-12-10 10:28:15
Original
4367 people have browsed it

How to clear phpmyadmin database

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

How to clear phpmyadmin database

Move to the bottom and enter "Selected Items" Select Delete to perform the table deletion operation. As shown below:

How to clear phpmyadmin database

#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(&#39;localhost&#39;,&#39;root&#39;,&#39;123456&#39;);
//设置查询的数据库名称,比如CMSYOU当前设置的是phpcms
mysql_select_db(&#39;phpcms&#39;);
$rs=mysql_query(&#39;show tables&#39;);
while($arr=mysql_fetch_array($rs))
{
//设置要批量删除的数据库表前缀,如:v9_
    $TF=strpos($arr[0],&#39;v9_&#39;);
    if($TF===0){
        $FT=mysql_query("drop table $arr[0]");
       if($FT){
            echo "$arr[0] 删除成功!<br>";
            }
        }
}
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template