MySQL: How to set the Primary Key on phpMyAdmin?(MySQL:如何在 phpMyAdmin 上设置主键?)
问题描述
帮助!第一次使用 phpMyAdmin.我想设置为主键的列是phpMyAdmin中的TEXT,提示错误,不能设置主键!而且我不想将其更改为 INT.我该如何解决这个问题?百万感谢!
Help! First time using phpMyAdmin. The column that I intend to set as a primary key is of TEXT in phpMyAdmin, it gave me an error message, the primary key can't be set! And I don't want to change it to INT. How can I solve this? Million thanks!
附注.我还没有在这个表上输入任何值或关联任何其他表.
PS. I haven't input any values or relate any other tables on this table yet.
推荐答案
您可以在文本列上设置主键.在 phpMyAdmin 中,显示表的结构,单击索引,然后要求在某一列上创建索引.然后选择 PRIMARY,选择您的 TEXT 列,但您必须输入足够大的长度以使其唯一.
You can set a primary key on a text column. In phpMyAdmin, display the Structure of your table, click on Indexes, then ask to create the index on one column. Then choose PRIMARY, pick your TEXT column, but you have to put a length big enough so that its unique.
这篇关于MySQL:如何在 phpMyAdmin 上设置主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL:如何在 phpMyAdmin 上设置主键?


基础教程推荐
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01