Using external database, database (without schema) and user created only, entrypoint.sh do not handle this, see below in chk_remote_mysql (). Entrypoint.sh call zm_create.sql only when connect to sql server and db not found, but this need user with high privileges. You should consider option when you have external database and user, and call create schema sql only. zm_create.sql need to be parametrized with database name ( database name "zm" is hardcoded )
# Check the status of the remote mysql server using supplied credentials
chk_remote_mysql () {
if [ "$remoteDB" -eq "1" ]; then
echo -n " * Looking for remote database server"
if [ "$(mysql_running)" -eq "1" ]; then
echo " ...found."
else
echo " ...failed!"
return
fi
echo -n " * Looking for existing remote database"
if [ "$(zm_db_exists)" -eq "1" ]; then
echo " ...found."
else
echo " ...not found."
echo -n " * Attempting to create remote database using provided credentials"
mysql -u${ZM_DB_USER} -p${ZM_DB_PASS} -h${ZM_DB_HOST} < $ZMCREATE
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo " ...done."
else
echo " ...failed!"
echo " * Error: Remote database must be manually configred."
fi
fi
else
# This should never happen
echo " * Error: chk_remote_mysql subroutine called but no sql credentials were given!"
fi
}
Workaround
Note: database name have to be "zm", otherwise update zm_create.sql
In external mysql, create database and user;
create database zm;
grant all privileges on zm.* TO 'user'@'%' identified by 'password';
flush privileges;
call zm_create.sql from zoneminder container, BUT skip call entrypoint.sh
Note: using podman , but for docker is the same
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Using external database, database (without schema) and user created only, entrypoint.sh do not handle this, see below in chk_remote_mysql (). Entrypoint.sh call zm_create.sql only when connect to sql server and db not found, but this need user with high privileges. You should consider option when you have external database and user, and call create schema sql only. zm_create.sql need to be parametrized with database name ( database name "zm" is hardcoded )
Workaround
Note: database name have to be "zm", otherwise update zm_create.sql
# podman run -it --rm --entrypoint="" zoneminder:latest-el7 /bin/sh -c 'mysql --verbose -h12.34.56.78 -uuser -ppassword zm < /usr/share/zoneminder/db/zm_create.sql '> zm_create.log