$ mysqldump --add-drop-table --add-locks --all --quick --lock-tables mydatabase > mydatabase.sql
2: Convert from Latin1 character encoding to UTF8
$ iconv -f latin1 -t utf8 < mydatabase.sql > mydatabase\_utf8.sql
3: Update auto\_increment SQL definitions
$ sed -e "/auto\_increment/ s/DEFAULT '0'//" database\_utf8.sql > mydatabase\_utf8\_filtered.sql
4: Transfer the file to the new system
On the NEW system:
5: Create a SQL header lines with this content into a file called ‘sql\_headers’.:
set names utf8; drop database if exists mydatabase; create database mydatabase\_inv character set utf8; use chem\_mydatabase
6: Remove the leading comments on the SQL fileStrip everything down to the first real SQL statement. `— MySQL dump 8.22
—
— Host: localhost Database: mydatabase
— Server version 3.23.54 —
— Table structure for table ‘table1’
—` 7: Load the SQL into your database
cat sql\_headers mydatabase\_utf8.sql | mysql -u root -p
