Bug #74732 init_file use in windows needs ";" terminator

Submitted: 7 Nov 2014 12:13 Modified: 7 Nov 2014 18:21
Reporter: Keith Hollman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.6.21 OS:Windows (W7)
Assigned to: CPU Architecture:Any

[7 Nov 2014 12:13] Keith Hollman
Description:
When specifying init_file in the my.ini on windows, and there is more than 1 line, if no ";" is used, the lines are treated as 1, instead of more than 1.

Documentation states that no ; or other terminator 'should' be given.
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_init_file

How to repeat:
example:
- Setup db & table for testing:
 create database kh1;
 use kh1;
 create table test1 (now datetime, numero tinyint);
- right button click in some directory, New Text Document, notepad opens, introduce what we need:
use kh1
insert into test1 values (sysdate(),1),(sysdate(),2)
insert into test1 values (sysdate(),3),(sysdate(),4)
- Save (ANSI format automatically selected) and rename to .sql. Tried Unicode, Unicode Big Endian & UTF8. All fail.
- Add entry to my.ini init_file="C:\...".
- stop and start mysqld.
- Get the following in error log:
2014-11-07 13:05:17 3384 [Note] Execution of init_file 'C:\Users\khollman\Documents\cache_prep.sql' started.
ERROR: 1105  Bootstrap file error, return code (0). Nearest query: 'use kh1
insert into test1 values (sysdate(),1),(sysdate(),2)
insert into test1 values (sysdate(),3),(sysdate(),4)'
2014-11-07 13:05:17 3384 [Note] Execution of init_file 'C:\Users\khollman\Documents\cache_prep.sql' ended.
- Edit previous init_file, and add ";" at the end of each line (even when selecting database like 'use mysql')
- stop and start mysqld.
- Error log then reads:
2014-11-07 13:10:43 3100 [Note] Execution of init_file 'C:\Users\khollman\Documents\cache_prep.sql' started.
2014-11-07 13:10:43 3100 [Note] Execution of init_file 'C:\Users\khollman\Documents\cache_prep.sql' ended.
- And table test1 has the 4 inserted rows.

Suggested fix:
As Windows users have more options than linux/unix users when using a text editor and can save in different formats, the documentation should suggest that on windows platforms ";" be added in order for the commands to take effect.
[7 Nov 2014 18:21] MySQL Verification Team
Hello Keith,

Thank you for the bug report and test case.
Observed similar behavior on Win7 with MySQL version 5.6.21.

Thanks,
Umesh
[7 Nov 2014 18:22] MySQL Verification Team
// With 5.6.21

// my.ini
[mysqld]
.
.
init_file="D:\ushastry\mysql-5.6.21\init.sql"

// init.sql

use kh1
insert into test1 values (sysdate(),1),(sysdate(),2)
insert into test1 values (sysdate(),3),(sysdate(),4)

// Error log

2014-11-07 23:43:29 9372 [Note] Execution of init_file 'D:\ushastry\mysql-5.6.21\init.sql' started.
ERROR: 1105  Bootstrap file error, return code (0). Nearest query: 'use kh1
insert into test1 values (sysdate(),1),(sysdate(),2)
insert into test1 values (sysdate(),3),(sysdate(),4)'
2014-11-07 23:43:29 9372 [Note] Execution of init_file 'D:\ushastry\mysql-5.6.21\init.sql' ended.

// After statement terminator such as ; used in init.sql

2014-11-07 23:47:42 9528 [Note] Execution of init_file 'D:\ushastry\mysql-5.6.21\init.sql' started.
2014-11-07 23:47:42 9528 [Note] Execution of init_file 'D:\ushastry\mysql-5.6.21\init.sql' ended.
2014-11-07 23:47:42 9528 [Note] bin\mysqld: ready for connections.

mysql> select * from test1;
+---------------------+--------+
| now                 | numero |
+---------------------+--------+
| 2014-11-07 23:47:42 |      1 |
| 2014-11-07 23:47:42 |      2 |
| 2014-11-07 23:47:42 |      3 |
| 2014-11-07 23:47:42 |      4 |
+---------------------+--------+
4 rows in set (0.00 sec)

mysql> show variables like '%version%';
+-------------------------+---------------------------------------------------------+
| Variable_name           | Value                                                   |
+-------------------------+---------------------------------------------------------+
| innodb_version          | 5.6.21                                                  |
| protocol_version        | 10                                                      |
| slave_type_conversions  |                                                         |
| version                 | 5.6.21-enterprise-commercial-advanced                   |
| version_comment         | MySQL Enterprise Server - Advanced Edition (Commercial) |
| version_compile_machine | x86_64                                                  |
| version_compile_os      | Win64                                                   |
+-------------------------+---------------------------------------------------------+
7 rows in set (0.00 sec)
[8 Apr 2015 7:17] MySQL Verification Team
This bug appeared 5.6. 5.0,5.1,5.5 works well without delimiter.
And it's not only window but also linux.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.058 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.