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('localhost','数据库用户名','数据库密码');<br/>//设置查询的数据库名称<br/>mysql_select_db('数据库名称');<br/>$rs=mysql_query('show tables');<br/>while($arr=mysql_fetch_array($rs))<br/>{<br/>//设置要批量删除的数据库表前缀,如:51php<br/> $TF=strpos($arr[0],'51php_');<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!