问题: 前一天我将mysql配置好了,就关闭了,第二天重新启动mysql容器发现刚启动完,就停止掉了,很离谱!!!
解决方案: docker logs mysql
查看mysql日志,发现报错:
unknown variable ‘default_character_set=utf8’.
发现是配置文件的问题:
修改前配置文件是:
[mysqld]
skip-name-resolve
#default_character_set = utf8 //删掉此行
character_set_server=utf8
datadir=/var/lib/mysql
server-id=1000
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8
修改后配置文件是:
[mysqld]
skip-name-resolve
character_set_server=utf8
datadir=/var/lib/mysql
server-id=1000
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8