基本操作
(1) 登录MYSLQ
步骤如下:
① (win+R)--->cmd-->命令窗口--->输入" mysql -uroot -P端口号 -p "
②登录成功效果
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.29 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.
(2) 显示所有数据库
命令: show databases;
效果演示:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| bjpowernode |
| dbtest1 |
| detest2 |
| display |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
8 rows in set (0.00 sec)
(3) 选择数据库
命令:use 数据库名;
效果演示:
mysql> use bjpowernode;
Database changed
(4) 展示 tables
命令:show tables;
效果演示:
mysql> show tables;
+-----------------------+
| Tables_in_bjpowernode |
+-----------------------+
| bjpowernode |
| dept |
| emp |
| salgrade |
+-----------------------+
4 rows in set (0.00 sec)
(5) 查看表内容
命令: desc 表;
mysql> desc dept;标签:+--------------------+,tables,show,MYSQL,笔记,mysql,MySQL,基本操作,bjpowernode From: https://blog.51cto.com/u_15314328/5728165
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| DEPTNO | int | NO | PRI | NULL | |
| DNAME | varchar(14) | YES | | NULL | |
| LOC | varchar(13) | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)