Is there a way to prevent special characters on schema objects? I would like to prevent the creation of objects with spaces or special characters.
Is there a way to allow only letters, numbers, and the underscore?

Thanks!
MySQL was designed to include special characters in Schema Object Names such as


database names
table names
column names


Certain characters (such as ' '(blank), hyphens (-), and other strange characters) can still be used within Schema Object Names by enclosing the identifier in backquotes (`).

According to the MySQL Documentation on Schema Object Names, there are a variety of characters that are permitted within Schema Object Names:


  Identifiers are converted to Unicode internally. They may contain
  these characters:
  
  Permitted characters in unquoted identifiers:
  
  ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar,
  underscore)
  
  Extended: U+0080 .. U+FFFF
  
  Permitted characters in quoted identifiers include the full Unicode
  Basic Multilingual Plane (BMP), except U+0000:
  
  ASCII: U+0001 .. U+007F
  
  Extended: U+0080 .. U+FFFF
  
  ASCII NUL (U+0000) and supplementary characters (U+10000 and higher)
  are not permitted in quoted or unquoted identifiers.
  
  Identifiers may begin with a digit but unless quoted may not consist
  solely of digits.
  
  Database, table, and column names cannot end with space characters.


You are welcome to get the source code, tweek it to check all characters in any potential Schema Object Identifier, and either allow or deny.

The only thing I can suggest is never to use backquotes when creating databases and tables.