博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Mysql简单操作
阅读量:4097 次
发布时间:2019-05-25

本文共 1186 字,大约阅读时间需要 3 分钟。

//Mysql版本:5.7.13

 

1.以管理员身份运行命令提示符,转到mysql的安装位置
2.启动mysql服务:net start mysql        
3.root身份登录:mysql -uroot -p 回车键
4.列出所有数据库:show databases;
5.创建一个数据库:create databases Database_Name;
6.判断是否存在再创建数据库:create databases if not exists Database_Name;
7.删除数据库:drop database Database_Name;
8.选择一个数据库:use Database_Name;
9.列出选中数据库中的所有数据表:show tables;
10.展示数据表的列(column)详情:show columns from Table_Name;或者:describe Table_Name;
11.选中展示数据表:select * from Table_Name;
12.带条件展示数据表:select * from Table_Name where id>=2;
13.创建数据表:create table Table_Name(col_01_Name Type Details,col_02_Name Type Details,...);
14.先判断再创建数据表:create table if not exists Table_Name(...);
15.复制数据表:create table Table_Name_01 select * from Table_Name_02;
16.重命名数据表:alter table Table_Name rename as New_Table_Name;或者:rename table Old_Name to New_Name;
17.删除数据表:drop table Table_Name;
18.向数据表添加纪录:insert into Table_Name set col_01=Value1,col_02=Value2;
19.修改数据表中的记录:update Table_Name set col_Name=New_Value where id=1;
20.删除数据表中的记录:delete from Table_Name;
21.带条件删除数据表中的记录:delete from Table_Name where id=1;
22.#当前时间查看:select now();
23.#当前用户:select user();
24.#当前数据库程序版本:select version();
25.#当前状态:show status;
26.#查看当前连接的用户:show processlist;

转载地址:http://fmlii.baihongyu.com/

你可能感兴趣的文章
新一代Java模板引擎Thymeleaf
查看>>
Spring MVC中使用Thymeleaf模板引擎
查看>>
Spring Boot构建简单的微博应用
查看>>
Spring处理表单提交
查看>>
Spring MVC异常处理
查看>>
Leetcode 1180. Count Substrings with Only One Distinct Letter [Python]
查看>>
PHP 7 的五大新特性
查看>>
php使用 memcache 来存储 session
查看>>
php实现socket(转)
查看>>
PHP底层的运行机制与原理
查看>>
深入了解php底层机制
查看>>
PHP中的stdClass 【转】
查看>>
XHProf-php轻量级的性能分析工具
查看>>
PHP7新特性 What will be in PHP 7/PHPNG
查看>>
比较strtr, str_replace和preg_replace三个函数的效率
查看>>
ubuntu 下编译PHP5.5.7问题:configure: error: freetype.h not found.
查看>>
PHP编译configure时常见错误 debian centos
查看>>
configure: error: Please reinstall the BZip2 distribution
查看>>
OpenCV gpu模块样例注释:video_reader.cpp
查看>>
【增强学习在无人驾驶中的应用】
查看>>