Home >Database >phpMyAdmin >How to clear phpmyadmin database

How to clear phpmyadmin database

(*-*)浩
(*-*)浩Original
2019-12-09 11:40:242043browse

How to clear phpmyadmin database

1. Use the phpmyadmin tool to delete mysql database tables in batches (Recommended learning: phpmyadmin tutorial)

Use the phpmyadmin database Management tools to delete, this is a traditional method, you can operate in any PHP virtual host. The following is an introduction to the operation process:

Log in to phpmyadmin. Select your mysql database name to enter - click Structure - select the data table you want to delete - select Delete in "Selected Items" to perform the table deletion operation.

2. Use php script to complete batch deletion

I found a piece of php code from the Internet, which can also help us quickly delete it. If you are "sensitive" to the phpmyadmin tool, you can use the following method to quickly delete the mysql database table.

After copying the following code to Notepad, you should pay attention to several issues during the configuration process:

<?php<br/>//设置数据库连接信息。数据库服务器地址,数据库用户名,数据密码<br/>mysql_connect(&#39;localhost&#39;,&#39;数据库用户名&#39;,&#39;数据库密码&#39;);<br/>//设置查询的数据库名称<br/>mysql_select_db(&#39;数据库名称&#39;);<br/>$rs=mysql_query(&#39;show tables&#39;);<br/>while($arr=mysql_fetch_array($rs))<br/>{<br/>//设置要批量删除的数据库表前缀,如:51php<br/>    $TF=strpos($arr[0],&#39;51php_&#39;);<br/>    if($TF===0){<br/>        $FT=mysql_query("drop table $arr[0]");<br/>       if($FT){<br/>            echo "$arr[0] 删除成功!<br>";<br/>            }<br/>        }<br/>}<br/>?><br/>

1. Correctly configure your mysql database information. You can get this by consulting your space provider directly.

2. Correctly set the prefix of the database table to be deleted. This is very important. If you fill it in incorrectly, the operation will be wrong. Please be sure to confirm your database table prefix. You can query the database table prefix in phpmyadmin. Usually it starts with xx_.

After setting up, save this code as a .php file (such as 51php.php) and upload it to the website root directory (public_html) of your space. After uploading, just use the domain name /51php.php to delete it.

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!

Statement:
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