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 上设置主键?


- SQL 临时表问题 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01