Why we cannot TRUNCATE Multiple Tables in MySQL directly:
1
2
3
4
5
|
TRUNCATE TABLE <table_name>;
|
Also read about SEO
SemRush is best SEO Tool in 2022
SEMrush vs Ahrefs vs WebCEO vs Moz Pro :Which is Best SEO Tool
Solution:
1
2
3
4
5
|
SELECT Concat('TRUNCATE TABLE ',table_schema,'.',TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES where table_schema in (db1_name,db2_name);
|
Also read
How much does YouTube pay for 10,000 views
Mondly Review - There are 41 Languages Waiting for You
Top 50 Apps for Real Money Making | Apps for Cash
20+ Best Free Youtube Downloader App
20 Best Free Facebook Video Downloader
Logan Paul net worth - Salary, House, Cars, Income, Age
TOP 20 Plagiarism Checker Software (Free/Paid)
1
2
3
4
5
|
mysql -uuser -p -e"SELECT Concat('TRUNCATE TABLE ',table_schema,'.',TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES where table_schema in (db1_name,db2_name);" > ouput.sql
|
1
2
3
4
5
|
mysql -uuser -p database_name< output.sql
|
1
2
3
4
5
|
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
|
Best Software Discount
GSA search engine ranker Discount
Advanced SystemCare 15 pro Review | Get 25 % Discount
Iobit Driver Booster 9 PRO Review – Get 25 % Discount
IObit Smart Defrag 8 pro Review & discount
IObit Malware Fighter 9 PRO Review & Discount
IObit Software Updater 5 PRO Review | Get 25% Discount
IObit Uninstaller 11 Pro review - Get 25% Discount
Macbooster 8 pro Discount
IOTransfer 4 Pro Discount
Start Menu 8 PRO Reviewand discount
iFun Screen Recorder Pro Review and discount
FOREIGN_KEY_CHECKS variable value
1
2
3
4
5
6
|
SET FOREIGN_KEY_CHECKS=0; (This will disable FOREIGN KEY check)
|
1
2
3
4
5
|
SET FOREIGN_KEY_CHECKS=1;
|
No comments:
Post a Comment