Syntax\n------\n\nALTER {DATABASE | SCHEMA} [db_name]\n    alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n    UPGRADE DATA DIRECTORY NAME\n\nalter_specification:\n    [DEFAULT] CHARACTER SET [=] charset_name\n  | [DEFAULT] COLLATE [=] collation_name\n  | COMMENT [=] 'comment'\n\nDescription\n-----------\n\nALTER DATABASE enables you to change the overall characteristics of a database. These characteristics are stored in the db.opt file in the database directory. To use ALTER DATABASE, you need the ALTER privilege on the database. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe CHARACTER SET clause changes the default database character set. The COLLATE clause changes the default database collation. See Character Sets and Collations for more.\n\nYou can see what character sets and collations are available using, respectively, the SHOW CHARACTER SET and SHOW COLLATION statements.\n\nChanging the default character set/collation of a database does not change the character set/collation of any stored procedures or stored functions that were previously created, and relied on the defaults. These need to be dropped and recreated in order to apply the character set/collation changes.\n\nThe database name can be omitted from the first syntax, in which case the statement applies to the default database.\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause. It updates the name of the directory associated with the database to use the encoding implemented in MySQL for mapping database names to database directory names (see Identifier to File Name Mapping). This clause is for use under these conditions:\n\n It is intended when upgrading MySQL from older versions.\n It is intended to update a database directory name to the current encoding format if the name contains special characters that need encoding.\n* The statement is used by mariadb-check (as invoked by mariadb-upgrade).\n\nFor example, if a database in MySQL 5.0 has a name of a-b-c, the name contains instance of the \\-' character. In 5.0, the database directory is also named a-b-c, which is not necessarily safe for all file systems. In MySQL, the same database name is encoded as a@002db@002dc to produce a file-system-neutral directory name.\n\nWhen a MySQL installation is upgraded from an older version, the server displays a name such as a-b-c (which is in the old format) as #mysql50#a-b-c, and you must refer to the name using the #mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to explicitly tell the server to re-encode the database directory name to the current encoding format:\n\n`sql\nALTER DATABASE #mysql50#a-b-c UPGRADE DATA DIRECTORY NAME;\n`\n\nAfter executing this statement, you can refer to the database as a-b-c without the special #mysql50` prefix.\n\nMariaDB starting with 10.5.0\n\nFrom MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024 bytes. If the comment length exceeds this length, a error/warning code 4144 is thrown. The database comment is also added to the db.opt file, as well as to the information_schema.schemata table.\n\nExamples\n--------\n\nALTER DATABASE p COMMENT='Presentations';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-database