# urbestack-database-user-adopt

First published 30 Nov 2026 (release 0.2.36) · Last changed 1 Dec 2026 (release 0.2.37)

UrbeStack release 0.2.39 command, run as root in the server shell.

## Usage

```
urbestack-database-user-adopt --name NAME --user CUSTOMER [--dry-run]
```

## Description

Assigns a MariaDB user name created outside UrbeStack to the customer named by --user as one of the customer's database users. Use it for an account created at the shell or restored before its UrbeStack records. UrbeStack keeps the account's password hash so applications that sign in with the account keep working. It records grants on the customer's databases as full when the grant includes every privilege on the database, read-only when it includes only SELECT and SHOW VIEW, and custom for any other list of privileges. MariaDB treats an unescaped underscore in a grant as a wildcard. UrbeStack records such a grant for the database whose name matches the name in the grant literally. UrbeStack then manages the database user's password, grants and deletion as the customer's.

UrbeStack applies the recorded grants to every existing account with that name and creates any missing localhost, 127.0.0.1 and ::1 accounts with the same password hash. It creates the ::1 account only if IPv6 loopback is available. --dry-run shows which grants UrbeStack would record and makes no changes.

UrbeStack refuses adoption, lists every reason and makes no changes if any account lacks a mysql_native_password hash or has more than one authentication method, or if passwords or grants differ across hosts. It also refuses adoption if any account has a global privilege, GRANT OPTION, a role, a PROXY privilege, or a grant on a table, column, routine, name pattern, one of MariaDB's own databases or a database the customer does not own. It also refuses adoption if two grants on the same host name the same database and differ in privileges, with the underscore escaped in only one grant. To grant privileges on an unowned database, first adopt it with urbestack-database-adopt. The command refuses the names of MariaDB's own accounts (root and mysql).

## Same in the API

- [POST /databases/users/{name}/adopt](https://urbestack.com/docs/api/post-databases-users-name-adopt.md): Assign an existing MariaDB user name to a customer as a database user

## Command family: database

- [urbestack-database-add](https://urbestack.com/docs/commands/urbestack-database-add.md): Creates a MariaDB database and records the customer named by --user as its owner.
- [urbestack-database-adopt](https://urbestack.com/docs/commands/urbestack-database-adopt.md): Assigns an existing MariaDB database with no recorded owner to the customer named by --user.
- [urbestack-database-del](https://urbestack.com/docs/commands/urbestack-database-del.md): Drops a database and all its data, and removes its ownership record and grants.
- [urbestack-database-grant-set](https://urbestack.com/docs/commands/urbestack-database-grant-set.md): Sets a database user's privileges on a named database.
- [urbestack-database-install](https://urbestack.com/docs/commands/urbestack-database-install.md): Installs MariaDB 10.11 from the distribution for customer databases.
- [urbestack-database-list](https://urbestack.com/docs/commands/urbestack-database-list.md): Lists databases by their recorded ownership in UrbeStack.
- [urbestack-database-signon](https://urbestack.com/docs/commands/urbestack-database-signon.md): Returns a one-time phpMyAdmin sign-on URL for the account named by --user.
- [urbestack-database-signon-retire](https://urbestack.com/docs/commands/urbestack-database-signon-retire.md): Retires passwords issued to hidden phpMyAdmin database users by replacing them with undisclosed passwords.
- [urbestack-database-user-add](https://urbestack.com/docs/commands/urbestack-database-user-add.md): Creates a database user for a customer.
- [urbestack-database-user-del](https://urbestack.com/docs/commands/urbestack-database-user-del.md): Drops a database user and its grants from UrbeStack and MariaDB, including accounts created by hand for other hosts.
- [urbestack-database-user-list](https://urbestack.com/docs/commands/urbestack-database-user-list.md): Lists the database users managed by UrbeStack, with their grants.
- [urbestack-database-user-set](https://urbestack.com/docs/commands/urbestack-database-user-set.md): Changes a database user's password for every MariaDB host with an account under that name, including hosts added by hand.

## Change log

Most recent first.

- 0.2.37 · 1 Dec 2026 · The command now rejects accounts with a role, a PROXY privilege, more than one authentication method, a grant on one of MariaDB's own databases, or two grants on the same host for the same database with different privileges. These accounts were previously eligible for adoption. The command also returns status 400 for root and mysql.
- 0.2.36 · 30 Nov 2026 · First published.
