next up previous contents
Next: 刪除 ibdata Up: 縮小 ibdata1 Previous: 備份資料庫   Contents

刪除資料庫

  1. 登入 mysql。
    [root@moodle mysql]# mysql -uroot -p123qwe
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 205886
    Server version: 5.5.38 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
  2. 查看資料庫,再逐一刪除非 mysql 內建的資料庫。
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | lost+found         |
    | moodle23           |
    | mysql              |
    | openmeetings       |
    | performance_schema |
    | test               |
    +--------------------+
    7 rows in set (0.02 sec)
    
  3. 刪除資料庫 moodle23。
    mysql> drop database moodle23;
    Query OK, 0 rows affected (0.01 sec)
    
  4. 刪除資料庫 openmeetings。
    mysql> drop database openmeetings;
    Query OK, 0 rows affected (0.01 sec)
    
  5. 最後只剩 mysql 內建資料庫。
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | lost+found         |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    5 rows in set (0.00 sec)
    
  6. 退出 mysql。
    mysql> exit
    Bye
    



2018-08-14