一、常用命令

1、查看数据库默认编码

show variables like 'character%';

show variables like 'collation%';

2、启动停止数据库

/etc/init.d/mysql start (stop)

3、创建数据库

create database if not exists 数据库名 default charset gbk collate gbk_chinese_ci;

create database if not exists 数据库名 default charset gbk collate gbk_bin;

create database if not exists 数据库名 default charset utf8mb4 collate utf8mb4_unicode_ci;

4、创建数据表

create table 表名 (

......

) engine=InnoDB default charset=utf8mb4 collate=utf8mb4_unicode_ci;

5、查看表当前字符集
show cereate table 表名;
6、查看字符集的排序规则
show collation
7、查看表类型
show create table tablename
8、创建用户并授权
grant all on 数据库名.* to '用户名'@'%' identified by '密码';
flush privileges;
create user '用户名'@'%' identified by '密码';
grant all on 数据库名.* to '用户名'@'%';
flush privileges;
9、权限撤销
revoke 权限名 on 数据库名.表名 from 用户名@主机名;
10、查看for update超时时间设置
show global variables like "%timeout%";
set global innodb_lock_wait_timeout = 10; 
11、查看正在锁和等待锁的事务
select * from information_schema.innodb_locks;
select * from information_schema.innodb_lock_waits;
 
二、概念解释
1、什么是collate?
2、engine=lnnoDB 和 MyISAM的区别?

最新文章

  1. SQL高级查询:嵌套和分页
  2. MMORPG大型游戏设计与开发(客户端架构 part2 of vgui)
  3. 10. JEB1.5 插件编写二
  4. php单链表实现的代码
  5. javaweb学习总结(三十九)——数据库连接池
  6. Eclipse启动时报需要安装"Java SE 6 Runtime"致无法启动解决方案
  7. Jafka来源分析——文章
  8. hdu 5625 Clarke and chemistry
  9. 使用java对执行命令行 或 执行bat文件
  10. 牛客 小a与星际探索 bfs
  11. linux上mongodb的安装与卸载
  12. vue教程2-04 vue实例简单方法
  13. RHEL7--linux系统启动流程与故障排除
  14. Scala_运算符
  15. Android:EditText 属性
  16. 1 python使用networkx或者graphviz,pygraphviz可视化RNN(recursive)中的二叉树
  17. SOJ4389 川大贴吧水王 队列
  18. 如何用dva来构建你的应用
  19. LeetCode 简单 - 最大子序和(53)
  20. HTML5/CSS3 第二章页面组件

热门文章

  1. 2019-2020-1 20199318《Linux内核原理与分析》第十一周作业
  2. js 获取标签属性值
  3. IE 浏览器element-ui table: show-overflow-tooltip 临界值时失效
  4. 错题记录:C51同一个hex文件偶尔效果不行 的处理方法
  5. heap 算法函数
  6. Java-AES256加密Util
  7. libevent学习之入门--[02]从hello-world开始
  8. Leetcode本地阅读器开发--01界面设计一
  9. HTTP-看这一篇就够了
  10. 会话保持 Session和cookie