Hello
Iâm trying to install nextcloud using a mysql docker but i have some problems.
On my server running Ubuntu 18.04, i have already a Zimbra OpenSource install and so i cannot install mysql-servver ou mariadb server because zimbra use is own mysql server âŠ
So, the solution to install nextcloud on the same server, is to install mysql-server on a docker.
I install docker and do this to setup mysql:
#> docker run --name=mysql-nextcloud --restart=always -e MYSQL_ROOT_HOST=% -p 3306:3306 -d mysql/mysql-server:5.7
#> docker exec -it mysql-nextcloud mysql -u root -p
when connecting to mysql i setup this:
mysql> CREATE DATABASE nextcloud;
mysql> GRANT ALL PRIVELEGES ON . TO ânextcloudâ@â%â IDENTIFIED BY âmypasswordâ;
now, when i try to install nextcloud i enter :
admin user: admin-nextcloud
passe : testtest
-data directory : /hdd/raid1/nextcloud-data
-database-user: nextcloud
database-pass: mypassword
databae: nextcloud
host : 127.0.0.1:3306
but i have the error :
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1044] Access denied for user âoc_admin-nextcloâ@â%â to database ânextcloudâ
if i try with root i have:
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ârootâ@â172.17.0.1â (using password: YES)
if i try with newtcloud user and the ip of docker (wich i found with docker inspect -f â{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}â mysql-nextcloud), i have the same error :
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1044] Access denied for user âoc_admin-nextcl1â@â%â to database 'nextcloud
if someone can help me âŠ
And sorry for my bad english
thanks all!
why you donât use the docker mechanism to create the database? that is to say use the env variables: MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWOR -> https://hub.docker.com/_/mysql (same for mariadb)
if you want to keep data persistent with docker you put them into a volume. a volume is a directory on the host that is not deleted when you delete/remove the container and therefore can be reused with another container. (e.g. when you update nextcloud.)
if you choose an absolute path e.g. -v /opt/nextcloud:/var/www/nextcloud/data youâll find all your data in /opt/nextcloud. if you choose something like nextcloud as a volume name youâll have to look in /var/lib/docker/volumes.
the second methode is the better one. you donât get confused with file ownership and security. docker will take care about.
docker has an internal dns. and the name of the container is the internal dns name of your âdb serverâ. so use mysql-nextcloud instead of ip adress.
and donât expose the port. omit the following. normally you donât want to access the db from outside the docker network.