Hi there!
I just reached out to my friend and he sent me more files. He doesn’t use this:
He uses a custom Dockerfile:
FROM mysql:5.7
ENV MYSQL_PASSWORD=CHANGEHERE
ENV MYSQL_ROOT_PASSWORD=CHANGEHERE
COPY ./default-bindaddress.sh /data/
RUN chmod +x /data/default-bindaddress.sh
RUN ./data/default-bindaddress.sh
ADD ./db_scripts/* /docker-entrypoint-initdb.d/
EXPOSE 3306:3306
He created a db_scripts
folder and added some files to generate his DBs
Here are the other files:
default-bindaddress.sh:
#!/usr/bin/env bash
file="/etc/mysql/mysql.conf.d/mysqld.cnf"
if [ -w "$file" ] #Check if have write permissions
then
echo "Setting default bind_address to :: in /etc/mysql/mysql.conf.d/mysqld.cnf"
sed -i "s/.*bind-address.*/bind-address = CHANGEHERE.internal,0.0.0.0, ::/" /etc/mysql/my.cnf
sed -i "s/.*bind-address.*/bind-address = CHANGEHERE.internal,0.0.0.0, :: /" /etc/mysql/mysql.conf.d/mysqld.cnf
sef -i "s/.*wait_timeout.*/wait_timeout = 1200/" /etc/mysql/mysql.conf.d/mysqld.cnf
sef -i "s/.*wait_timeout.*/wait_timeout = 1200/" /etc/mysql/my.cnf
sef -i "s/.*net_read_timeout.*/net_read_timeout = 1200/" /etc/mysql/mysql.conf.d/mysqld.cnf
sef -i "s/.*net_read_timeout.*/net_read_timeout = 1200/" /etc/mysql/my.cnf
sef -i "s/.*sednet_write_timeout.*/sednet_write_timeout = 1200/" /etc/mysql/mysql.conf.d/mysqld.cnf
sef -i "s/.*sednet_write_timeout.*/sednet_write_timeout = 1200/" /etc/mysql/my.cnf
else
echo "Can't write to $file. Try running the script with 'sudo'."
fi
mysqld.cnf:
[mysqld]
bind-address = *
Maybe not all these are needed but just wanted to share