I couldn't find anything on google, maybe I am not searching the correct term. But is there a list of not allowed character for column names in mysql database ? I am particularly interested in the $ sign.
            Asked
            
        
        
            Active
            
        
            Viewed 1.4k times
        
    16
            
            
        - 
                    https://dev.mysql.com/doc/refman/5.0/en/identifiers.html – Professor Abronsius Oct 02 '15 at 05:54
- 
                    While mysql doesn't require `$` to be quoted, when working with PHP be aware of interpolation within strings and escape accordingly. – Edurne Pascual Feb 21 '17 at 01:34
1 Answers
22
            Extracted from the MySQL docs assuming you are using at least MySQL 5.0 or higher:
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 
TL;DR
Answering your question, yes.. You can use the $ character in column names quoted or unquoted.
 
    
    
        Brandon White
        
- 997
- 9
- 22
- 
                    If this is true for quoted identifiers, then why is this giving me a duplicate value error: col1 ENUM('VŠS', 'VSS') ? Seems that only ASCII is allowed here... – TomoMiha Apr 24 '20 at 08:41
- 
                    2@TomoMiha I think you are confusing `collation config` with `permitted characters`. Take a look at this question for more details: https://stackoverflow.com/questions/34387766/use-accent-senstive-primary-key-in-mysql – Brandon White Apr 26 '20 at 12:43
- 
                    Thanks, I found in the meanwhile that I had to change that COLLATION thing from ut8mb4_unicode_ci to utf8mb4_bin to make it work – TomoMiha Apr 27 '20 at 07:37
