[mysqld] user=mysql default-storage-engine=INNODB character-set-server=utf8 secure-file-priv=NULL # mysql 8 新增这行配置 default-authentication-plugin=mysql_native_password # mysql 8 新增这行配置 port = 3306 # 端口与docker-compose里映射端口保持一致 #bind-address= localhost #一定要注释掉,mysql所在容器和django所在容器不同IP basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock skip-name-resolve # 这个参数是禁止域名解析的,远程访问推荐开启skip_name_resolve。 [client] port = 3306 default-character-set=utf8 [mysql] no-auto-rehash default-character-set=utf8