[MDEV-15760] mysqldump / restore fails Created: 2018-04-03  Updated: 2018-12-10  Resolved: 2018-05-16

Status: Closed
Project: MariaDB Server
Component/s: Backup
Affects Version/s: 10.2.14
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Ilya Shipitsin Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: need_feedback
Environment:

windows 2016


Attachments: PNG File Screenshot from 2018-04-03 15-54-11.png     PNG File Screenshot from 2018-04-03 16-03-51.png     PNG File Screenshot from 2018-04-03 16-05-16.png    

 Description   

I installed mariadb-10.2.14 (use utf8 as default character set)
I did mysqldump (test database)
I tried to do restore, it failed

please find screenshots attached



 Comments   
Comment by Elena Stepanova [ 2018-04-03 ]

Well, is \0 expected, and if it is, did you try to set --binary-mode as the message suggests?

Comment by Ilya Shipitsin [ 2018-04-03 ]

the issue was because of powershell (see blue screen).

powershell ">" is different from cmd ">"

when run from cmd - everything is ok

Comment by Elena Stepanova [ 2018-04-03 ]

wlad, any comments on this?

Comment by Vladislav Vaintroub [ 2018-04-03 ]

there is --result-file option in mysqldump that can/shall be used with mysqldump, instead of redirection

Comment by Ilya Shipitsin [ 2018-04-04 ]

I guess there's BOM
will have a look later

does it make sense to teach mysql.exe to understand BOM ? or just close this issue ?

Comment by Vladislav Vaintroub [ 2018-04-04 ]

--result-file should not write a BOM. Does it?
I'd prefer some better raw pipe handling in powershell, along the lines of https://github.com/PowerShell/PowerShell/issues/1908.

I'd like to redirect the questions about whether mysql understands UTF16, and question concerning BOMs to bar

Comment by Ilya Shipitsin [ 2018-04-04 ]

"--result-file should not write a BOM. Does it?" - I was talking about powershell

Comment by Vladislav Vaintroub [ 2018-04-04 ]

there is a section in MySQL's documentation dedicated to this very topic https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html
about mysqldump and powershell and UTF16.
Let me quote it in full

 Note
 
A dump made using PowerShell on Windows with output redirection creates a file that has UTF-16 encoding:
 
shell> mysqldump [options] > dump.sql
 
However, UTF-16 is not permitted as a connection character set (see Section 10.4, “Connection Character Sets and Collations”), so the dump file will not load correctly. To work around this issue, use the --result-file option, which creates the output in ASCII format:
 
shell> mysqldump [options] --result-file=dump.sql

it specifically mentions --result-file as a workaround.

Generated at Thu Feb 08 08:23:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.