Skip to content

Instantly share code, notes, and snippets.

@abcprintf
Created August 7, 2023 05:03
Show Gist options
  • Save abcprintf/1d7560ed622382f30e834b289f082cb0 to your computer and use it in GitHub Desktop.
Save abcprintf/1d7560ed622382f30e834b289f082cb0 to your computer and use it in GitHub Desktop.
Import Mysql With Command line (Fast)

set allow max executetime

SET GLOBAL max_allowed_packet=1073741824;
SET GLOBAL wait_timeout=6000;
SET GLOBAL net_read_timeout=6000;
SET GLOBAL connect_timeout=6000;

// sql_mode default local
sql_mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION";
// sql_mode prod
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION";

// sql_mode new
SET GLOBAL sql_mode="";

Import Mysql With Command Line (Fast)

// import structure
mysql.exe -u root -p --compress --force [DATABASE_NAME] < "\dump\[DATABASE_NAME].sql"

// import data
mysql.exe -u root -p --compress --force [DATABASE_NAME] < "\dump\[DATABASE_NAME].sql"

How to import mysql

Export method:
  Custom - display all possible options
  
  Format-specific options:
    [/] Disable foreign key checks
    
  Object creation options
    [/] Add CREATE PROCEDURE / FUNCTION / EVENT statement
    [/] Add CREATE TRIGGER statement
    
  Data creation options
    [/] INSERT IGNORE statements (** import data only)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment