MySQL:如何在phpMyAdmin上设置主键? [英] MySQL: How to set the Primary Key on phpMyAdmin?

查看:151
本文介绍了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.我尚未在此表中输入任何值或关联任何其他表.

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上设置主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆