C# mysql创建索引名中带有空格的唯一索引

C# mysql创建索引名中带有空格的唯一索引,c#,mysql,indexing,C#,Mysql,Indexing,当我运行查询时 CREATE UNIQUE INDEX User Name ON my_table (user_name) OR CREATE UNIQUE INDEX "User Name" ON my_table (user_name) mysql抛出一个1064错误: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the

当我运行查询时

CREATE UNIQUE INDEX User Name ON my_table (user_name)

OR

CREATE UNIQUE INDEX "User Name" ON my_table (user_name)
mysql抛出一个1064错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Name on my_table (user_name)' at line 1
如何创建索引名中包含一些空格字符的索引,我已经尝试使用引号,但没有效果

更多信息:当主管希望添加更多用户(通过我的应用程序中的配置菜单),并且某些列中存在重复值时,.NET将抛出一个异常,称“重复输入'John'作为键'Some_key'”


我想使键的名称与列名相同,这样错误会显示为例如“重复输入'John'作为键'User name'”。

如果要包含空格,则需要使用如下反勾:

CREATE UNIQUE INDEX `User Name` ON my_table (user_name)