zoukankan      html  css  js  c++  java
  • MySQL删除数据库

    drop命令用于删除数据库。

    drop命令格式:drop database <数据库名>;

    例如,删除名为 xhkdb的数据库:
    mysql> drop database xhkdb;

    [例子1] 删除一个已经确定存在的数据库:
       mysql> drop database drop_database;
       Query OK, 0 rows affected (0.00 sec)

    [例子2] 删除一个不确定存在的数据库:
        mysql> drop database drop_database;
        ERROR 1008 (HY000): Can't drop database 'drop_database'; database doesn't exist
        // 发生错误,不能删除'drop_database'数据库,该数据库不存在。

        mysql> drop database if exists drop_database;
        Query OK, 0 rows affected, 1 warning (0.00 sec)
        //产生一个警告说明此数据库不存在

        mysql> create database drop_database;  // 创建一个数据库
        Query OK, 1 row affected (0.00 sec)
        mysql> drop database if exists drop_database;  // if exists 判断数据库是否存在,不存在也不产生错误
        Query OK, 0 rows affected (0.00 sec)

  • 相关阅读:
    oracle 安装
    C++中 接口的定义 COM
    linux查看及改变运行级别
    BSD Apache GPL LGPL MIT
    DES MAC PIN HEX
    c语言字符输出格式化
    oracle
    Windows C++ 子目录数量
    GetProcAddress 宏
    How do I install Adobe Flash on Debian Wheezy?
  • 原文地址:https://www.cnblogs.com/DanBrown/p/8308371.html
Copyright © 2011-2022 走看看