• 查看创建好的数据库


    MySQL从小白到总裁完整教程目录:https://blog.csdn.net/weixin_67859959/article/details/129334507?spm=1001.2014.3001.5502

    语法格式:

    show create database 数据库名称;

    案列:查看testing数据库信息

    1. mysql> show create database testing;
    2. +----------+-----------------------------------------------------------------+
    3. | Database | Create Database |
    4. +----------+-----------------------------------------------------------------+
    5. | testing | CREATE DATABASE `testing` /*!40100 DEFAULT CHARACTER SET gbk */ |
    6. +----------+-----------------------------------------------------------------+
    7. 1 row in set (0.00 sec)

    练习:查看当前有多少个数据库

    1. mysql> show databases;
    2. +--------------------+
    3. | Database |
    4. +--------------------+
    5. | information_schema |
    6. | bd_ecshop |
    7. | mysql |
    8. | performance_schema |
    9. | test |
    10. | testing |
    11. +--------------------+
    12. 6 rows in set (0.01 sec)

     一共有六个数据库

    查看一下数据库名称为MySQL的数据库的字符集是什么

    1. mysql> show create database mysql;
    2. +----------+------------------------------------------------------------------+
    3. | Database | Create Database |
    4. +----------+------------------------------------------------------------------+
    5. | mysql | CREATE DATABASE `mysql` /*!40100 DEFAULT CHARACTER SET latin1 */ |
    6. +----------+------------------------------------------------------------------+
    7. 1 row in set (0.00 sec)

    字符集是Latin1

    比如说我把数据库名写错,它会怎么显示

    1. mysql> show create database mysql222;
    2. ERROR 1049 (42000): Unknown database 'mysql222'

    练习:创建一个数据库名称为czwbkl,字符集为utf8                数据库的全名是橙子味冰可乐的缩写,以后经常会用到,哈哈哈

    1. mysql> create database czwbkl charset utf8;
    2. Query OK, 1 row affected (0.00 sec)
    3. mysql> show databases;
    4. +--------------------+
    5. | Database |
    6. +--------------------+
    7. | information_schema |
    8. | bd_ecshop |
    9. | czwbkl |
    10. | mysql |
    11. | performance_schema |
    12. | test |
    13. | testing |
    14. +--------------------+
    15. 7 rows in set (0.00 sec)
    16. mysql> show create database czwbkl;
    17. +----------+-----------------------------------------------------------------+
    18. | Database | Create Database |
    19. +----------+-----------------------------------------------------------------+
    20. | czwbkl | CREATE DATABASE `czwbkl` /*!40100 DEFAULT CHARACTER SET utf8 */ |
    21. +----------+-----------------------------------------------------------------+
    22. 1 row in set (0.00 sec)

  • 相关阅读:
    费解的开关 刷题笔记
    [山东科技大学OJ]2675 Problem C: 回文数字
    Python武器库开发-面向对象篇(五)
    DELETE、TRUNCATE 和 DROP 在MySQL中的区别及使用示例
    3种方式自动化控制APP
    数据指标显示,目前还没到牛市顶点 2021-04-24
    关于环境保护html网页设计完整版,5个以环境为主题的网页设计与实现
    LitCTF2024部分wp
    Springboot 启动Bean如何被加载
    提前尝鲜,Android 13首个Beta发布
  • 原文地址:https://blog.csdn.net/weixin_67859959/article/details/132818332