Linux commands: Difference between revisions

Jump to navigation Jump to search
831 bytes added ,  29 December 2013
Line 102: Line 102:
=== import MySql sql dump file ===
=== import MySql sql dump file ===
{{exclaim}} Notice: existing database will be overwritten
{{exclaim}} Notice: existing database will be overwritten
* {{Gd}} Import the compressed *.sql file with gzip (especially for BIG sql file). It will show a progress bar and estimate time to complete the mysql command:
*# (optional if the {{kbd | key =pv}} was not installed) {{kbd | key =yum install pv}} for RHEL / CentOS / SL / Fedora Linux<ref>[http://www.cyberciti.biz/open-source/command-line-hacks/pv-command-examples/ Linux / Unix pv Command: Monitor Progress of Data Sent Via a Pipe]</ref>
*# {{kbd | key =  <nowiki> pv database.sql.gz | gunzip | mysql -u username -p -h localhost DATA-BASE-NAME</nowiki>}} <ref>[http://journal.andrewloe.com/2009/05/12/pv-gzip-mysql/ pv + gzip + mysql — W. Andrew Loe III: Journal]</ref> and press {{kbd | key =  <nowiki>Enter</nowiki> }}
*# enter {{kbd | key =  <nowiki>password</nowiki> }} and press {{kbd | key =  <nowiki>Enter</nowiki> }}
* Import *.sql file:  
* Import *.sql file:  
*# (optional if the .sql file was compressed) {{kbd | key =unzip data.zip}} or {{kbd | key =gzip -d data.gz}} if the file was compressed by gzip
*# (optional if the .sql file was compressed) {{kbd | key =unzip data.zip}} or {{kbd | key =gzip -d data.gz}} if the file was compressed by gzip

Navigation menu