I would like to ommit the table-prefix in my Mariadb Database. I tried changing my setting
'dbtableprefix' => 'oc_',
to
'dbtableprefix' => '',
But that gave only an Internal Server Error
on the website after starting it with
docker-compose up
I also tried adding this in docker-compose.yaml
:
- NEXTCLOUD_TABLE_PREFIX=
But that had no effect, I guess it is only used during a fresh install
How can I change my table-prefix?
There seems something odd overall, I tried to reinstall my developer docker version, but there the NEXTCLOUD_TABLE_PREFIX is not working:
opened 11:48AM - 15 Jun 19 UTC
I set NEXTCLOUD_TABLE_PREFIX=oc_ in my db.env to migrate an old installation to docker.
It didn't work so I added it in the...
question
I figured it out:
#!/usr/bin/env bash
D=your_myriadb_docker_image_name
MYSQL_ROOT_PASSWORD=secret
ALL_TABLES=$(docker exec ${D} mysql nextcloud -p$MYSQL_ROOT_PASSWORD -e "show tables"|tail -n +2)
for i in $ALL_TABLES; do
T="$(echo $i|sed 's/^oc_//g')"
docker exec ${D} mysql nextcloud -p$MYSQL_ROOT_PASSWORD -e "RENAME TABLE oc_$T to $T"
done
sed "s/dbtableprefix'\s*=>\s*'oc_'/dbtableprefix' => ''/" volumes/html/config/config.php -i
BUT be aware , that a longer prefix than 3 characters is not intended to work, and will be disabled in future releases!
1 Like
Asto
May 17, 2020, 3:11pm
3
Thanks, stumbled upon the same thing. Your script saved me some time, thanks
But you could/should do the sed inside the apps docker container too, just to be on the safe side with permissions, the file path etc. But people doing this will know how to do that
Also be aware that removing the oc_ prefix from the tables could cause issues with things .