mysql set varchar_mySQL set a varchar without the special characters
时间: 2023-12-18 16:02:51 浏览: 33
To set a VARCHAR column in MySQL without special characters, you can use the following syntax:
```
ALTER TABLE table_name MODIFY column_name VARCHAR(length) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
```
Replace `table_name` and `column_name` with your actual table and column names, and replace `length` with the desired length of the VARCHAR column.
The `utf8mb4` character set supports the storage of all Unicode characters, including special characters. The `utf8mb4_general_ci` collation is a Unicode-based collation that is case-insensitive and accent-insensitive, which means it treats special characters as their base characters. This collation is suitable for most applications that require case-insensitive and accent-insensitive string comparisons.