Michael Profile Picture
Michael Malura
Entwickler - Fotograf - Technologie-Enthusiast

Import/Export mysql


2018-03-22 mysql shell linux

With this snippets i can create a complete dump of a mysql database.

dump

mysqldump --host="xyz" \
--user="xyz" --password="xyz" \
--default-character-set=latin1 \
--result-file="./dump.sql" \
--lock-tables --add-locks --create-options \
--extended-insert --add-drop-table --disable-keys \
databasename

import

mysql --user="xyz" --password="xyz" \
--default-character-set=utf8 \
databasename < dump.sql

better import

mysql -u root -p
mysql> SET names 'utf8'
mysql> SOURCE dump.sql