Back

[SOLVED] Update the MariaDB credentials

  • 0
  • Databases
  • Tools
  • General
  • Self Hosted
kathelia.dokgu
17 Jul, 2023, 21:13

On a development environment I used the code provided on the docs to self-host Appwrite:

TypeScript
docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:1.3.7

This uses a bunch of default values which is fine on my localhost since it's only meant for development anyway. But I used the same command when hosting Appwrite on my server as production. I realized that I didn't change the credentials for MariaDB:

TypeScript
_APP_DB_USER=user
_APP_DB_PASS=password
_APP_DB_ROOT_PASS=rootsecretpassword

I want to change this now but I just want to make sure that if I did change these three values, I won't lose any data. What's the best way for me to go about this? Obviously I'll back up the data first but I don't want any headaches so I don't want to start without any plans.

I guess I'm just wondering if it's safe for me to just change the values and then run docker compose up --force-recreate --remove-orphans -d.

TL;DR
User wants to update the MariaDB credentials for their Appwrite instance. They are unsure if changing the values in the .env file will result in data loss. They want to know the best approach to make this change. Solution: User can safely change the values in the .env file and then run `docker compose up --force-recreate --remove-orphans -d` to apply the changes without any data loss.
Drake
18 Jul, 2023, 01:05

no, you'll have to update the password just like you would any mariadb database: by running the sql commands to do so. Then, you can update the values in your .env file so your appwrite instance uses those updated values

kathelia.dokgu
18 Jul, 2023, 02:28

Ah silly me, of course lol. Thank you! I was overthinking it again.

Drake
18 Jul, 2023, 02:37

[SOLVED] Update the MariaDB credentials

kathelia.dokgu
18 Jul, 2023, 02:45

@Steven After changing the root password for both % and localhost, I added a new user with a different password for both % and localhost as well. I granted all privileges exactly as the root user has. After running ``docker compose up --force-recreate --remove-orphans -d` I've been getting a bunch of Sentry logs:

TypeScript
read error on connection to redis:6379 pubSubConnection
Redis server redis:6379 went away pubSubConnection
kathelia.dokgu
18 Jul, 2023, 02:46

I did update the .env file to use the new account I created and also updated the root password with what I changed it to.

Drake
18 Jul, 2023, 02:49

Try to restart the appwrite container again

Drake
18 Jul, 2023, 02:49

You should also inspect the container to verify the environment variables are correct

kathelia.dokgu
18 Jul, 2023, 02:51

Thank you, I restarted the containers and it seems to have stopped.

kathelia.dokgu
18 Jul, 2023, 03:14

Well, it looks like it’s still going.. I’ll take a look at it tomorrow but I was wondering if I should change any of the redis credentials after the stuff I did? Also what’s the command to make sure the verify that the environment variables being loaded are correct?

Drake
18 Jul, 2023, 03:16

You can't put a password on redis at the moment.

TypeScript
docker compose exec appwrite vars

Or you can inspect the docker container

kathelia.dokgu
18 Jul, 2023, 03:19

Okay thanks, I’ll do that tomorrow since it doesn’t seem like it has broken anything anyway, or at least not that I noticed.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more