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 上设置主键?
基础教程推荐
- 无法解决整理冲突 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
