当前位置:网站首页>Windows下cmd窗口连接mysql并操作表
Windows下cmd窗口连接mysql并操作表
2022-07-29 05:19:00 【学习记录而已】
1、
mysql安装完毕后,命令窗口连接需配置path环境变量,值为mysql安装的目录/bin。如图,Windows + r 弹出命令窗口 cmd,回车
2、
在DOS命令窗口输入 mysql -hlocalhost -uroot -p回车 进入mysql数据库,其中-h表示服务器名,localhost表示本地;-u为数据库用户名,root是mysql默认用户名;-p为密码,如果设置了密码,可直接在-p后链接输入,如:-p123456,用户没有设置密码,显示Enter password时,直接回车即可。
注意,如果你的mysql没有安装在C盘下,你需要先使用DOS命令进入mysql的安装目录下的bin目录中。如:安装在了e盘,输入e:进入e盘,在输入cd e:\Tools\MySQL5.5.25\bin进入到mysql的bin目录下才可以输入 mysql -hlocalhost -uroot -p
3、
查看所有的数据库,输入“show databases:”,注意一定要加上英文状态下的分号,因为mysql中是以分号来标志结束的。如果没有加可能报错也可能界面上什么都没显示,此时,需要我们结束该语句,按下Ctrl+c重新输入就可以了,
4、
查询数据库中所有的表。需要先指定数据库:”use 库名;” 然后通过 “show tables”来查看
5、、
查询指定表的所有字段:show columns from 数据库名称.表名
创建数据库:create database 数据库名称;
6、创建表:CREATE TABLE 表名称
(
列名称1 数据类型,
列名称2 数据类型,
列名称3 数据类型,
….
)
如:创建一张student表:
create table student
(
s_id int,
s_name varchar(255),
s_age varchar(255)
)
7、我偷懒了啦啊啊,不过后面也没了
边栏推荐
- Qtcreator+cmake compiler settings
- link与@import的关系
- What is wapiti and how to use it
- 【JS题解】牛客网JS篇1-10题
- Display effect of uniapp page title
- 基础爬虫实战案例之获取游戏商品数据
- QT layout management -- Part stretch principle and sizepolicy
- Clickhouse learning (x) monitoring operation indicators
- Do students in the science class really understand the future career planning?
- DAY4:MySQL 数据库的建立及简单实用
猜你喜欢

与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库

Provincial and urban three-level linkage (simple and perfect)

Three handshakes and four waves for the interview summary

Clickhouse learning (XI) clickhouseapi operation

Installation steps and environment configuration of vs Code

大部分PHP程序员,都搞不懂如何安全代码部署

DAY6:利用 PHP 编写文件上传页面
![[C language series] - storage of deep anatomical data in memory (I) opening of summer vacation](/img/a8/367ff90ad1b65c404de446d198365b.png)
[C language series] - storage of deep anatomical data in memory (I) opening of summer vacation

Sqlmap是什么以及使用方法

DAY14:Upload-labs 通关教程
随机推荐
DAY4:SQL Sever 简单使用
Qtcreator+cmake compiler settings
Clickhouse learning (XI) clickhouseapi operation
Display effect of uniapp page title
Clickhouse learning (IV) SQL operation
Win10 搭建MSYS2环境
Flask 报错 RuntimeError: The session is unavailable because no secret key was set.
uniapp组件之选择选项(如套餐选择)
Summary of the first week
移动端-flex项目属性
微信小程序更改属性值-setData-双向绑定-model
365 day challenge leetcode1000 question - day 036 binary tree pruning + subarray and sorted interval sum + delete the shortest subarray to order the remaining arrays
Wapiti是什么以及使用教程
Build msys2 environment with win10
组件传参与生命周期
table中同一列中合并相同项
Related knowledge of elastic box
基础爬虫实战案例之获取游戏商品数据
Clickhouse learning (IX) Clickhouse integrating MySQL
Basic use of redis