Wednesday, November 28, 2018

File Compress,Gunzip,Mysql Command in Terminal Ubuntu

Compress and extract command in Ubuntu.
  • Compress File to Tar:  
tar czf name_of_archive_file.tar.gz name_of_directory_to_tar
  • Extract File from Tar: 
tar -xzvf file.tar.gz
  • Extract gz to MYSQL: 
gunzip < file-name.sql.gz | mysql -u user -p password  database-name
  • Compress MYSQL to gz: 
mysqldump -u user -p password database-name |gzip -9 > file-name.sql.gz 
  • Export
mysqldump -u user  -p password database-name > file-name.sql
  • Import: 
mysql -user -password database-name < file-name.sql
Share: