---
title: "ALTER DATABASE"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_alter_db/"
---

# ALTER DATABASE

Use the ALTER DATABASE statement to redefine the attributes of a database.

## Synopsis

Use the `ALTER DATABASE` statement to redefine the attributes of a database.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
alter_database ::= ALTER DATABASE name 
                   [ [ WITH ] alter_database_option [ ... ]
                     | RENAME TO name
                     | OWNER TO { new_owner
                                  | CURRENT_USER
                                  | SESSION_USER }
                     | SET run_time_parameter { TO | = } 
                       { value | DEFAULT }
                     | SET run_time_parameter FROM CURRENT
                     | RESET run_time_parameter
                     | RESET ALL ]

alter_database_option ::= ALLOW_CONNECTIONS allowconn
                          | CONNECTION LIMIT connlimit
                          | IS_TEMPLATE istemplate
```

#### alter\_database

ALTERDATABASE[name](/stable/api/ysql/syntax_resources/grammar_diagrams#name)WITH[alter\_database\_option](#alter-database-option)RENAMETO[name](/stable/api/ysql/syntax_resources/grammar_diagrams#name)OWNERTO[new\_owner](/stable/api/ysql/syntax_resources/grammar_diagrams#new-owner)CURRENT\_USERSESSION\_USERSET[run\_time\_parameter](/stable/api/ysql/syntax_resources/grammar_diagrams#run-time-parameter)TO=[value](/stable/api/ysql/syntax_resources/grammar_diagrams#value)DEFAULTSET[run\_time\_parameter](/stable/api/ysql/syntax_resources/grammar_diagrams#run-time-parameter)FROMCURRENTRESET[run\_time\_parameter](/stable/api/ysql/syntax_resources/grammar_diagrams#run-time-parameter)RESETALL

#### alter\_database\_option

ALLOW\_CONNECTIONS[allowconn](/stable/api/ysql/syntax_resources/grammar_diagrams#allowconn)CONNECTIONLIMIT[connlimit](/stable/api/ysql/syntax_resources/grammar_diagrams#connlimit)IS\_TEMPLATE[istemplate](/stable/api/ysql/syntax_resources/grammar_diagrams#istemplate)

## Semantics

Note

Some options in DATABASE are under development.

### *name*

Specify the name of the database to be altered.

### ALLOW\_CONNECTIONS

Specify `false` to disallow connections to this database. Default is `true`, which allows this database to be cloned by any user with `CREATEDB` privileges.

### CONNECTION\_LIMIT

Specify how many concurrent connections can be made to this database. Default of `-1` allows unlimited concurrent connections.

### IS\_TEMPLATE

S`true` — This database can be cloned by any user with `CREATEDB` privileges. Specify `false` to Only superusers or the owner of the database can clone it.

## See also

- [CREATE DATABASE](/stable/api/ysql/the-sql-language/statements/ddl_create_database "CREATE DATABASE")
- [DROP DATABASE](/stable/api/ysql/the-sql-language/statements/ddl_drop_database "DROP DATABASE")
- [SET](/stable/api/ysql/the-sql-language/statements/cmd_set "SET")
