docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.48k stars 2.21k forks source link

Single-quote character docker secrets causes failure in user creation #1049

Closed gsch-cmi closed 7 months ago

gsch-cmi commented 7 months ago

MySQL image fails to run when using docker secrets with MYSQL_PASSWORD_FILE when password file contains a single-quote (') character. Removing the single quote from the password file results in a successful run. It seems that some additional escaping of the password input, or at least documentation regarding this limitation would be helpful.

Thanks very much!

2024-05-01 11:19:59-04:00 [Note] [Entrypoint]: Creating database <redacted>
2024-05-01 11:19:59-04:00 [Note] [Entrypoint]: Creating user <redacted>
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<redacted>' at line 1
 *  Terminal will be reused by tasks, press any key to close it. 
tianon commented 7 months ago

I think we've probably got a better issue for it, but https://github.com/docker-library/mysql/pull/613#issuecomment-564793428 has some very related comments (effectively, we don't currently escape passwords, which causes problems like this one).

gsch-cmi commented 7 months ago

Gotcha, thanks for the response, that issue definitely clarifies the problem better. Feel free to close this or leave open as suits your needs.