php批量删除数据库下指定前缀的表以prefix_为例_PHP
如何用php批量删除数据库下所有前缀为prefix_的表。
例子,统一删除前缀为“prefix_”的表。
<?php //设置数据库连接信息。数据库服务器地址,数据库用户名,数据密码 mysql_connect('数据库主机','数据库用户名','数据库密码'); //设置查询的数据库名称 mysql_select_db('数据库名'); $rs=mysql_query('show tables'); while($arr=mysql_fetch_array($rs)) { //设置要批量删除的数据库表前缀,如:prefix_ $TF=strpos($arr[0],'prefix_'); if($TF===0){ $FT=mysql_query("drop table $arr[0]"); if($FT){ echo "$arr[0] 删除成功!<br>"; } } } ?>
操作实例:
新建一个php文件,保存为deletedata.php。
比如,要删除www.bitsCN.com或者http://www.bitsCN.com/的后台数据,操作两个步骤就ok:
1. 首先将这个保存好的deletedata.php文件上传至你的网站根目录;
2. 直接在地址栏输入:www.bitsCN.com/deletedata.php或者http://www.bitsCN.com/deletedata.php执行这个删除脚本即中。
该脚本会在浏览器中显示出所有表删除成功的信息。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to delete Weibo posts in batches? To delete Weibo posts in batches, you can follow the steps below: Log in to your Weibo account and visit your personal center in the browser. Click More under Admin Center or Apps and select My Apps. Search and find the batch deletion Weibo tool in the App Market. Using this tool, you can choose to delete some Weibo posts or delete them all at once. After completing the deletion operation, if you need to restore the deleted content within 24 hours, you can use the member privilege "Regret Medicine". This function cannot be used after 24 hours. In addition, there are other methods to achieve batch deletion of Weibo, such as using specific browser plug-ins, but these methods may not be officially supported and may pose security risks. Therefore, it is recommended to give priority to the official

Several ways to implement batch deletion statements in MyBatis require specific code examples. In recent years, due to the increasing amount of data, batch operations have become an important part of database operations. In actual development, we often need to delete records in the database in batches. This article will focus on several ways to implement batch delete statements in MyBatis and provide corresponding code examples. Use the foreach tag to implement batch deletion. MyBatis provides the foreach tag, which can easily traverse a set.

When editing Excel, you may need to add the same prefix to a column of data. If you add them one by one, it is a waste of time. Is there any way to add prefixes to Excel in batches? Of course there are, and here are some commonly used methods of adding prefixes. How to quickly add a prefix in Excel? 1. Cell formatting method 1. Select the cell range and press Ctrl1 at the same time to set the cell format. (Or right-click the mouse and select Format Cells) 2. Click [Customize], enter "Finance Department-@" in the [Type] option, and finally click [OK] to complete! 2. Plug-in method 1. Download and install the Excel plug-in Square Grid.

Detailed explanation of how to use MyBatis batch delete statements requires specific code examples. Introduction: MyBatis is an excellent persistence layer framework that provides rich SQL operation functions. In actual project development, we often encounter situations where data needs to be deleted in batches. This article will introduce in detail how to use MyBatis batch delete statements, and attach specific code examples. Usage scenario: When deleting a large amount of data in the database, it is inefficient to execute the delete statements one by one. At this point, you can use the batch deletion function of MyBatis

With the development of the digital age, short video platforms such as Kuaishou have become the main way for us to record our lives and share our happiness. However, over time, we may notice that the content we post no longer meets current aesthetic standards, or there may be some privacy and security concerns. 1. How to delete works published by Kuaishou in batches? 1. Log in to your Kuaishou account and enter your personal homepage. 2. At the bottom of your personal homepage, find the "Works" option and click to enter. 3. On the work list page, find the "..." button in the upper right corner and click to enter. 4. In the pop-up menu, select the "Batch Delete" option. 5. At this time, the system will pop up a dialog box asking you to confirm the deletion of the selected works. Please confirm carefully and click "OK". 6. Batch deletion

What is the magnet link prefix? Magnet links are a method for sharing files on the Internet. It has become the preferred way for many people to share and download resources. It allows users to easily get the files they need through a unified link. However, for those who are new to magnet links, some of the terms and concepts may be confusing. One of the common questions is, what is the magnet link prefix? Before answering this question, let us first understand the basic structure of magnet links. Magnet links consist of two parts: prefix and unique

With the popularity of Douyin, more and more people have begun to publish their works on Douyin. Over time, some people may want to delete their published works. So, how to delete works published on Douyin in batches? We also want to prevent others from downloading our Douyin works. How should we do this? 1. How to delete works published on Douyin in batches? 1. Log in to Douyin APP, enter your personal homepage, and click "Me" in the lower right corner. 2. On the "Me" page, find the "Works" column and click to enter. 3. In the work list, find the work you want to delete and long press the work. 4. After long pressing the work, the deletion option will pop up, select "Delete". 5. After deleting a single work, if you want to delete multiple works, you can continue to select other works to delete, or

Xunlei is a download software based on multi-resource hyper-threading technology developed by Xunlei. Many users want to modify the prefix after downloading files through Xunlei and saving them. How to set it? In fact, the operation is very simple, let’s take a look with the editor below. How to change the prefix of Thunder link? 1. First open and enter Thunder, then click the New button in the upper left corner. 2. Click the Add download link option and change the input method to English. 3. It is recommended to copy and paste the link content directly into the download box. 4. Finally add the name of the modified link prefix and click Download Now.
