Linux MySQL Commands

 

  1.      Log into mysql
mysql -u root -p
  1. Import database as root user
mysql -u root -p mydatabase < backup.sql
  1. Import database as non root user
mysql -u myuser -p mydatabase < backup.sql
  1. Check tables
USE mydatabase;<br>SHOW TABLES;
  1. Delete all tables one by one
SET FOREIGN_KEY_CHECKS = 0;<br>DROP TABLE IF EXISTS <code>table1table2table3, ...;
SET FOREIGN_KEY_CHECKS = 1;</code>

Take Backup of Database

mysqldump -u root -p mydatabase > mydatabase_backup.sql

Comments

Popular posts from this blog

How to create dynamic HTML sitemap in WordPress with a shortcode (and exclude post types)

How to add a GST number field to WooCommerce checkout and order emails

5 websites to get icons completely free