Connections_
Connect to your MySQL database with the mysql client or any standard driver. Retrieve connection details and rotate the primary password.
2 min read
A native MySQL database exposes a MySQL endpoint over TLS. You connect to it the same way you would connect to any MySQL server: with the mysql client, any driver in any language, or any ORM.
Get connection details with the API
The connection details are returned on the database object itself. Fetch the database with an API key that has the databases.read scope:
The response includes the connection fields alongside the database configuration:
{ "$id": "<DATABASE_ID>", "name": "main", "engine": "mysql", "version": "8.4", "status": "ready", "hostname": "db-<hash>.<region>.appwrite.center", "connectionPort": 3306, "connectionUser": "admin", "connectionPassword": "<password>", "connectionString": "mysql://admin:<password>@db-<hash>.<region>.appwrite.center:3306/<database>"}The primary user is admin and the database name is generated per database.
Connect with the mysql client
Pass the individual connection values to the mysql command-line client and enter the password when prompted:
mysql -h db-<hash>.<region>.appwrite.center -P 3306 -u admin -p -D <database>Rotate the primary password
If your password is compromised, or your security policy requires regular rotation, you can issue a new password for the primary user. The change is applied atomically in the engine, and the response carries the new connection details. Existing sessions stay alive until they disconnect, then have to authenticate with the new password. The API key needs the databases.write scope.
TLS
Connections on Appwrite Cloud are encrypted with TLS, terminated at the edge and forwarded to your database over the internal network. The connection string returned on the database object carries the right SSL settings for your environment, so drivers need no extra configuration.
For IP allowlists and other network controls, see network security.
Connecting from an application
There is nothing Appwrite-specific about the driver setup. A few example snippets:
Set the environment variables from the connection details on the database object. Once you can run a query, you can use any tool that talks the MySQL wire protocol: MySQL Workbench, DataGrip, your ORM of choice, your migration tool of choice. Appwrite gets out of the way.
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.