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 上设置主键?
基础教程推荐
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 在多列上分布任意行 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
