› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
JohnZorn
V2EX  ›  MySQL

这个怎么退出 error 度娘到的感觉答非所问啊

  •  
  •   JohnZorn · Dec 2, 2017 · 4135 views
    This topic created in 3223 days ago, the information mentioned may be changed or developed.

    删除主键约束的时候 自动把唯一约束的键作为了新的主键 然后在删除主键就成这样了 有没有可以不退出命令行 不关服务 不退 mysql 就可以让语句生效啊 现在怎么写都是在 error 里面 。。绝望

    8 replies  •  2017-12-03 10:06:44 +08:00
    JohnZorn
        1
    JohnZorn  
    OP
       Dec 2, 2017
    id | smallint(5) unsigned | NO | | 0 | |
    | age | tinyint(3) unsigned | NO | | NULL | |
    +----------+----------------------+------+-----+---------+-------+
    4 rows in set (0.01 sec)

    mysql> ALTER TABLE users2
    -> DROP PRIMARY KEY;'
    ERROR 1091 (42000): Can't DROP 'PRIMARY'; check that column/key exists
    '> ALTER TABLE users2
    '> DROP PRIMARY KEY;
    '>
    '>
    '> SHOW COLUMNS FROM users2;
    '> \c
    '> \c;
    '> SHOW COLUMNS FROM users2;
    '> CTRL-C-\Q;
    '> CTRL-C-Q;
    '> username
    '> username;
    '> mysql>SHOW COLUMNS FROM users2;
    '> mysql> SHOW COLUMNS FROM users2;
    '> \q
    '> \q;
    '>
    JohnZorn
        2
    JohnZorn  
    OP
       Dec 2, 2017
    这是我命令行的东西 打什么都是在 error 里面 出不去了。。
    lujjjh
        3
    lujjjh  
       Dec 2, 2017   ❤️ 1
    你的第一条 SQL 语句后面多了个引号,所以一直在引号里(仔细看前面的提示符是 '>)。

    再敲个 '; 回车就行了。
    JohnZorn
        4
    JohnZorn  
    OP
       Dec 2, 2017
    大哥 强 感谢感谢
    kiwi95
        5
    kiwi95  
       Dec 2, 2017
    ......哈哈哈,楼主来卖萌的吗
    JohnZorn
        6
    JohnZorn  
    OP
       Dec 2, 2017
    新手。。见笑了。。
    DoraJDJ
        7
    DoraJDJ  
       Dec 2, 2017
    搜索技术性的问题时**强烈建议使用 Google 或者必应国际版**
    用百度很多搜到的都是过时内容或者是莆田系技术文章(手动斜眼
    dlrdegk
        8
    dlrdegk  
       Dec 3, 2017
    楼主这个 Google,Bing 也救不了他啊 233
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5068 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:55 · PVG 09:55 · LAX 18:55 · JFK 21:55
    ♥ Do have faith in what you're doing.