Home >Database >Mysql Tutorial > MySQL数据库常用基本命令应用分享02

MySQL数据库常用基本命令应用分享02

WBOY
WBOYOriginal
2016-06-07 17:41:34828browse

说明:本文来自老男孩linux运维实战培训-MySQL数据库培训课程系列内容1)视频讲解目录1MySQL服务操作.........................................................

说明:本文来自老男孩linux运维实战培训-MySQL数据库培训课程系列内容
1)视频讲解目录
1 MySQL服务操作............................................................................ 3
1.1 启动与关闭MySQL............................................................. 3
 1.1.1 单实例方法............................................................ 3
 1.1.2 多实例方法............................................................ 4
 1.2 登陆MySQL方法................................................................ 4
 1.2.1 单实例方法............................................................ 4
 1.2.2 多实例方法............................................................ 4
1.3 登陆MySQL后................................................................... 4
1.4 善用MySQL的help........................................................... 5
1.5退出MySQL方法................................................................. 7
1.6设置及修改mysql root用户密码...................................... 7
 1.6.1设置密码方法......................................................... 7
 1.6.2修改root密码法一................................................. 8
 1.6.3修改root密码法二................................................. 8
 1.6.4修改root密码法三................................................. 8
1.7如何找回丢失的mysql root用户密码............................... 8
 1.7.1 单实例启动方法..................................................... 8
 1.7.2 多实例启动方法..................................................... 8
 1.7.3 修改密码的方法..................................................... 8
 1.7.4 重启用新密码登陆................................................. 9
2 数据库操作................................................................................. 9
2.1 创建数据库...................................................................... 9
2.2显示数据库...................................................................... 11
2.3 删除数据库..................................................................... 12
2.4 连接数据库..................................................................... 12
2.5 查看当前连接的数据库................................................... 13
2.6 当前数据库包含的表信息................................................ 14
2.7 删除系统多余帐号.......................................................... 14
2.8 创建用户并赋予权限两法................................................ 15
 2.8.1 查看grant帮助................................................... 15
 2.8.1 create和grant配合法........................................ 16
 2.8.2 直接grant法....................................................... 18
 2.8.3 通过实验获得ALL PRIVILEGES包括哪些权限........ 19
 2.8.4 生产环境授权用户的建议..................................... 20
2.9查看mysql的用户........................................................... 23
3 表操作...................................................................................... 23
3.1准备................................................................................ 23
3.2建表................................................................................ 24
 3.2.1 建立测试表test.................................................. 24
 3.2.2 生产环境标准的UTF8格式表结构语句.................. 25
  3.2.2.1 mysql字段类型............................................. 25
  3.2.2.2 建立几个关联表:....................................... 26
  3.2.2.3 创建关联表语句........................................... 26
  3.2.2.4 某sns产品生产正式建表语句....................... 27
3.3 查表结构及建表的SQL.................................................... 27
 3.3.1 查看表结构.......................................................... 27
 3.3.2 查看建表语句....................................................... 28
 3.3.3 为字段创建索引................................................... 28
3.4插入数据......................................................................... 31
3.5 查询............................................................................... 34
 3.5.1 查询所有行............................................................ 34
 3.5.2 查询前几行数据..................................................... 34
 3.5.3 多表查询............................................................... 37
 3.5.4 使用explain查询select语句使用索引情况.............. 37
3.6 修改表中数据................................................................. 38
3.7 删除表中数据................................................................. 39
3.8 在表中增删改字段(dba操作).......................................... 41
3.9 更改表名........................................................................ 43
3.10 删除表.......................................................................... 45
3.11 mysql字段类型............................................................. 45
4 MySQL数据库的备份与恢复........................................................ 45
4.1 准备工作:首先建表填充数据......................................... 45
4.2 填充中文数据暴漏乱码问题............................................ 46
4.3 MySQL字符集介绍........................................................... 50
4.4 set names gbk在做什么?............................................. 52
4.5备份单个数据库............................................................... 57
4.6 mysqldump在做什么?.................................................... 59
4.7备份多个库...................................................................... 61
4.8备份单个表...................................................................... 61
4.9备份多个表...................................................................... 62
4.10备份数据库结构(不包含数据)........................................ 63
5恢复数据库................................................................................ 64
5.1 source命令恢复............................................................. 64
5.2 mysql命令恢复(标准).................................................... 70
6 mysql带-e参数实现非交互式对话............................................... 72
6.1 恢复mysql数据.............................................................. 72
6.2 查看mysql状态.............................................................. 73
7 mysql生产环境案例.................................................................... 76
7.1 mysql数据库批量插入数据shell脚本实现..................... 76
7.2 不登陆数据库执行mysql命令小结.................................. 77

2)视频实战讲解(全屏观看效果更好)

 


 相关视频内容请博友们多多关注老男孩的博客更新。
最后,美国空间,欢迎大家一起探讨学习和教学,如何让学习者有所收获,让从师者如何最大限度的把知识进行最大限度的传承。

本文出自 “老男孩linux运维” 博客,美国空间,香港服务器,请务必保留此出处

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn