title: What is the use of MYSQL8 variable 'character_set_database'?
body: <p>I use the SQL 'show variables like 'character%';' to show the character set in MySQL variables.I find a variable named 'character_set_database', I want to know the use of it. I get some info from the MySQL doc website. But I don't know the mean of 'default database' in the doc context. The keyword 'default database' makes me confused about the use of the variable 'character_set_database'.<br/>
  So please help me to explain the keyword '<strong>default database</strong>' or the use of variable '<strong>character_set_database</strong>' directly.</p>
  <p>The desc about attribute '<strong>character_set_database</strong>' in mysql website:</p>
  <blockquote>
  <p><strong>·</strong> character_set_database<br/>
  <br/><br/>The character set used by the <strong>default database</strong>. The server sets this variable whenever the <strong>default database</strong> changes. If there is no default database, the variable has the same value as character_set_server.
  <br/><br/>As of MySQL 8.0.14, setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables. See Section 5.1.9.1, “System Variable Privileges”.
  <br/><br/>The global character_set_database and collation_database system variables are deprecated and will be removed in a future version of MySQL.
  <br/><br/>Assigning a value to the session character_set_database and collation_database system variables is deprecated and assignments produce a warning. The session variables will become read-only in a future version of MySQL and assignments will produce an error. It will remain possible to access the session variables to determine the database character set and collation for the default database.&quot;</p>
  </blockquote>
  <p>The reference link : <a href="https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_character_set_database" rel="nofollow noreferrer">character_set_database</a></p>