温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

为什么MGR需要用主键

发布时间:2020-06-06 10:38:35 来源:亿速云 阅读:865 作者:Leah 栏目:MySQL数据库

为什么MGR需要使用主键?针对这个问题,今天小编总结这篇有关MGR表的文章,希望能帮助更多想解决这个问题的朋友找到更加简单易行的办法。

验证MGR架构表需要使用主键,不然插入数据会报错。

mysql> show tables;

+--------------+

| Tables_in_dd | +--------------+ | a            | +--------------+ 1 row in set (0.00 sec) mysql> desc a; +-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | id    | int(11) | YES  |     | NULL    |       | +-------+---------+------+-----+---------+-------+ 1 row in set (0.00 sec) mysql> insert into a values(1); ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin. mysql> alter table a add primary key (id); Query OK, 0 rows affected (0.02 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> desc a; +-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | id    | int(11) | NO   | PRI | NULL    |       | +-------+---------+------+-----+---------+-------+ 1 row in set (0.01 sec) mysql> insert into a values(1); Query OK, 1 row affected (0.00 sec) mysql> insert into a values(1); Query OK, 1 row affected (0.00 sec) mysql> select * from a; +----+ | id | +----+ |  1 | +----+ 1 row in set (0.00 sec)

看完上述内容,你们对MGR架构表需要使用主键的原因大概了解了吗?如果想了解更多相关文章内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI