---
title: "ALTER KEYSPACE"
url: "https://docs.yugabyte.com/stable/api/ycql/ddl_alter_keyspace/"
---

# ALTER KEYSPACE

Use the ALTER KEYSPACE statement to change the properties of an existing keyspace.

## Synopsis

Use the `ALTER KEYSPACE` statement to change the properties of an existing keyspace.

This statement is supported for compatibility reasons only, and has no effect internally (no-op statement).

The statement can fail if the specified keyspace does not exist or if the user (role) has no permissions for the keyspace ALTER operation.

## Syntax

### Diagram

#### alter\_keyspace

ALTERKEYSPACESCHEMA[keyspace\_name](/stable/api/ycql/grammar_diagrams#keyspace-name)[keyspace\_properties](/stable/api/ycql/grammar_diagrams#keyspace-properties)

#### keyspace\_properties

WITHREPLICATION={,[keyspace\_property](/stable/api/ycql/grammar_diagrams#keyspace-property)}ANDDURABLE\_WRITES=truefalse

### Grammar

```ebnf
alter_keyspace ::= ALTER { KEYSPACE | SCHEMA } keyspace_name
                       [ WITH REPLICATION '=' '{' keyspace_property '}']
                       [ AND DURABLE_WRITES '=' { true | false } ]

keyspace_property ::= property_name = property_value
```

Where

- `keyspace_name` and `property_name` are identifiers.
- `property_value` is a literal of either [boolean](/stable/api/ycql/type_bool "boolean"), [text](/stable/api/ycql/type_text "text"), or [map](/stable/api/ycql/type_collection "map") data type.

## Semantics

- An error is raised if the specified `keyspace_name` does not exist.
- An error is raised if the user (used role) has no ALTER permission for this specified keyspace and no ALTER permission for ALL KEYSPACES.
- YCQL keyspace properties are supported in the syntax but have no effect internally (where YugabyteDB defaults are used instead).

## Examples

```sql
ycqlsh> ALTER KEYSPACE example;
```

```sql
ycqlsh> ALTER KEYSPACE example WITH DURABLE_WRITES = true;
```

```sql
ycqlsh> ALTER KEYSPACE example WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND DURABLE_WRITES = true;
```

```sql
ycqlsh> ALTER SCHEMA keyspace_example;
```

```output
SQL error: Keyspace Not Found.
ALTER SCHEMA keyspace_example;
             ^^^^^^
```

```sql
ycqlsh> ALTER KEYSPACE example;
```

```output
SQL error: Unauthorized. User test_role has no ALTER permission on <keyspace example> or any of its parents.
ALTER KEYSPACE example;
^^^^^^
```

## See also

- [CREATE KEYSPACE](/stable/api/ycql/ddl_create_keyspace "CREATE KEYSPACE")
- [DROP KEYSPACE](/stable/api/ycql/ddl_drop_keyspace "DROP KEYSPACE")
- [USE](/stable/api/ycql/ddl_use "USE")
