Prevent user from creating tables and or databases with hyphens
mysql
Solution
The only restrictions on table identifiers are as follows:
- No identifier can contain ASCII NUL (0x00) or a byte with a value of 255.
- Database, table, and column names should not end with space characters.
- Database and table names cannot contain “/”, “\”, “.”, or characters that are not allowed in file names.
In order to have any other restrictions, you would have to examine the query in your system before running it and adjust it appropriately.
Problem
Is there way in MySQL to prevent someone from creating tables and/or databases with hyphens? (Other than striping privileges from the user.) For example, if we have user IamADummy who wants to do this, ``` CREATE TABLE `I-am-a-bad-table-name`; ``` OR ``` CREATE DATABASE `Bad-Idea`; ``` Is there a setting that would stop the user from doing so? Thanks!