Blog Bustle 02/03/2020
Truncate database mysql is an easy process to empty mysql database. Be careful before truncate database because we will not able to retrieve our data stored in database. All tables will get deleted after truncate database.
Step 1: Take your mysql database backup whom you want to empty.(Optional)
Step 2: Drop database.
Step 3: Create new database with the same name.
To take database backup in optional. But if you think you may need this database backup in future, it is important.
For example, i have student database. I want to empty student database. So what will be my truncate database mysql steps?
I am using local server. I am going to take student database backup from command line.
mysqldump -u [username] -p[password] [database_name] > [dump_file_name.sql]
In my case username is root, password is empty and i will save database backup by student.sql in d drive of computer and mysql database backup command will be
mysqldump -u root -p student > d:\student.sql
I have taken student database backup. Now i am going to delete student database and delete database query will be
drop database student;
I have deleted student database. Now i am going to create student database and create database query will be
create database student;
So by following these steps we can easily truncate database mysql. Hope you like this tutorial.
Sql Insert Query
Sql Update Query
Sql & Mysql difference
Sql Delete Query
Sql Select Query
Mysql no database selected error 1046
Sql Create Table
Sql Drop Table
Sql Alter Query(add, drop, modify & change column)
Sql Truncate Table
Sql Insert Into Query
Sql Rename Table
Sql DISTINCT Keyword
Sql WHERE Clause
Sql Like operator
Sql AND operator
Sql OR operator
Sql NOT operator
Combining Sql AND, OR & NOT operator
Sql IN operator
Sql NOT IN operator
Sql Count, Sum, Avg, Min, Max
Sql Order By clause
Sql Limit clause
Sql BETWEEN operator
Sql Group By clause
Sql Aliases
Sql Inner Join
Sql Left Join
Sql Right Join
Mysql Create Database
Mysql Create Database Command Line
Mysql Delete Database
Mysql Delete Database Command Line
Mysql Show Databases
Mysql Show Databases Command Line
Mysql Select Database
Mysql Select Database Command Line
Mysql Backup Database
Mysql Import Database
Mysql Copy Database
Mysql Rename Database
Truncate Database Mysql