SQL Restore and Backup

First need to create the DB if it doesn't exist:

CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;

restore:

mysql -u root -p -D dbname < dbBackup.sql

backup:

mysqldump -u root -ppassword dbname > dbBackup.sql


Posted by JB Uy on August 30, 2013 at 01:53 PM UTC
Edited on December 13, 2013 at 08:44 PM UTC
1 Notes

In the case that restore gives an error like:

ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: 'SQLite format 3'.

Solution:

- Open .sql backup file in text editor and encode it into utf8

- ie. Sublime Text: File > Save With Encoding > Utf-8

Posted by JB Uy on September 02, 2014 at 02:00 PM UTC
via hutility.notedock.com | Link
Public Comments
comments powered by Disqus