• MySQL数据库的练习(数据库的创建,使用,查看,查看表格,初始化数据库)


    MySQL的练习(数据库的创建,使用,查看,查看表格,初始化数据库)

    登入指令:
    mysql -u root -p + 数据库密码;

    练习指令:
    //创建数据库
    create database database_text1;

    例:
    C:\Users\lenon>mysql -u root -p
    Enter password: ***********

    //使用数据库
    use database_text1;

    //查看数据库
    show databases;

    //查看当前使用数据库内的表格
    show tables;

    //初始化数据库(source)->Soyrce是额外自定义程序(这里使用的是动力结点的程序)
    source E:\······后端······\2.1 ····SQL系列····\MYSQL\工具代码\初始化(source)\Source.sql;

    总体代码:

    Microsoft Windows [版本 10.0.22000.1219]
    (c) Microsoft Corporation。保留所有权利。
    
    //登入程序
    C:\Users\lenon>mysql -u root -p
    Enter password: ***********
    
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 36
    Server version: 8.0.31 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2022, Oracle and/or its affiliates.
    
    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.
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sakila             |
    | sys                |
    | world              |
    +--------------------+
    6 rows in set (0.00 sec)
    
    //create的使用
    mysql> create database database_text1;
    Query OK, 1 row affected (0.00 sec)
    
     //查看数据库
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | database_text1     |
    | information_schema |
    | mysql              |
    | performance_schema |
    | sakila             |
    | sys                |
    | world              |
    +--------------------+
    7 rows in set (0.00 sec)
    
    //使用数据库
    mysql> use database_text1;
    Database changed
    
    //查看当前使用数据库内的表格
    mysql> show tables;
    Empty set (0.00 sec)
    
    //初始化数据库(source)->Soyrce是额外自定义程序(这里使用的是动力结点的程序)
    mysql>  source E:\······后端······\2.1 ····SQL系列····\MYSQL\工具代码\初始化(source)\Source.sql;
    
    Query OK, 0 rows affected, 1 warning (0.02 sec)
    
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    Query OK, 0 rows affected, 1 warning (0.02 sec)
    
    Query OK, 0 rows affected, 5 warnings (0.01 sec)
    
    Query OK, 0 rows affected (0.01 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> show tables;
    +--------------------------+
    | Tables_in_database_text1 |
    +--------------------------+
    | dept                     |
    | emp                      |
    | salgrade                 |
    +--------------------------+
    3 rows in set (0.00 sec)
    
    mysql> drop database database_text1;
    Query OK, 3 rows affected (0.02 sec)
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sakila             |
    | sys                |
    | world              |
    +--------------------+
    6 rows in set (0.00 sec)
    
    mysql> quit
    Bye
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155

    感谢观看~

  • 相关阅读:
    go 端口转发 代理 --chatGPT
    简单迅速解决windows电脑下载windows应用商店(Microsoft Store)
    SharePoint Password Change and Expiration
    [前端开发] 前端工程代码规范 Husky + Commitlint + Prettier + Eslint + Stylelint
    海康监控视频无插件开发3.2版本运行demo
    对比学习模型小抄(1)
    Linux shell - 目录栈操作(pushd popd dirs)
    使用feign调用记录日志篇
    尾插建立单链表,C语言输出
    stm32——hal库学习笔记(SPI)
  • 原文地址:https://blog.csdn.net/qq_51212951/article/details/128114356