docker-compose.yml 特殊字符转义

MYSQL_ROOT_PASSWORD等键值对,可能会有特殊字符的字符串。使用引号来包围含有特殊字符的字符串。如果含有符号$,使用$$来代表$

You can use a $$ (double-dollar sign) when your configuration needs a literal dollar sign. This also prevents Compose from interpolating a value, so a $$ allows you to refer to environment variables that you don’t want processed by Compose.

Compose file version 3 reference | Docker Documentation

引用:
How to escape # in docker-compose – Stack Overflow
escaping – How can I escape a $ dollar sign in a docker compose file? – Stack Overflow
MYSQL_ROOT_PASSWORD special character missing with docker-compose.yml configuration · Issue #123 · docker-library/mysql · GitHub
yml配置文件中有特殊字符解决方案_iamlzyoco的博客-CSDN博客

MySQL default_character_set_name

SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "DATABASE_NAME";
ALTER DATABASE DATABASE_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER DATABASE DATABASE_NAME CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE TABLE_NAME CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE TABLE_NAME CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

引用:
mysql – How to fix “Incorrect string value” errors? – Stack Overflow
character encoding – How to convert an entire MySQL database characterset and collation to UTF-8? – Stack Overflow

Windows上的MySQL my.cnf my.ini

在Windows上,通常说的/etc/my.cnfmy.ini。如果MySQL已经作为服务启动,那么可以很容易地找到:

Win+R以准备运行,输入services.msc

找到MySQL并查看属性:

“C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe” –defaults-file=”C:\ProgramData\MySQL\MySQL Server 5.7\my.ini” MySQL57

其中defaults-file就是my.ini的路径。

引用:
mysql – I can not find my.cnf on my windows computer – Stack Overflow
mysql – How to change max_allowed_packet size – Stack Overflow
MySQL Bugs: #68516: MySQL workbench installed with MySQL 5.6 links to MySQL55 my.ini