1、数据的导入导出

2、查询结果的重定向

3、ON DUPLICATE KEY UPDATE对于指定的主键或者唯一键,insert时发生冲突则进行update操作。

4、解决MySQL中问乱码问题,分了5.7版本、8.0版本

  1. Microsoft Windows [版本 10.0.17763.805]
  2. (c) Microsoft Corporation。保留所有权利。
  3.  
  4. C:\Users\lfy>mysql -uroot -p
  5. Enter password: ****
  6. Welcome to the MySQL monitor. Commands end with ; or \g.
  7. Your MySQL connection id is
  8. Server version: 5.7.-log MySQL Community Server (GPL)
  9.  
  10. Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
  11.  
  12. Oracle is a registered trademark of Oracle Corporation and/or its
  13. affiliates. Other names may be trademarks of their respective
  14. owners.
  15.  
  16. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  17.  
  18. mysql> show variables like '%char%';
  19. +--------------------------+---------------------------------------------------------+
  20. | Variable_name | Value |
  21. +--------------------------+---------------------------------------------------------+
  22. | character_set_client | utf8 |
  23. | character_set_connection | utf8 |
  24. | character_set_database | latin1 |
  25. | character_set_filesystem | binary |
  26. | character_set_results | utf8 |
  27. | character_set_server | latin1 |
  28. | character_set_system | utf8 |
  29. | character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\ |
  30. +--------------------------+---------------------------------------------------------+
  31. rows in set, warning (0.01 sec)
  32.  
  33. mysql>

  1. ...
  2. # CLIENT SECTION
  3. # ----------------------------------------------------------------------
  4. #
  5. # The following options will be read by MySQL client applications.
  6. # Note that only client applications shipped by MySQL are guaranteed
  7. # to read this section. If you want your own MySQL client program to
  8. # honor these values, you need to specify it as an option during the
  9. # MySQL client library initialization.
  10. #
  11. [client]
  12. default-character-set=utf8
  13.  
  14. # [CLIENT_PIPE]=""
  15. # pipe=
  16.  
  17. # [CLIENT_SOCKET]="socket"
  18. # socket=
  19.  
  20. # [CLIENT_PORT]="port"
  21. port=
  22.  
  23. [mysql]
  24. no-beep
  25.  
  26. # [CLIENT_DEFAULT_CHARACTER_SET]=""
  27. # default-character-set=
  28. default-character-set=utf8
  29.  
  30. [database]
  31. default-character-set=utf8
  32.  
  33. [server]
  34. default-character-set=utf8
  35.  
  36. # SERVER SECTION
  37. # ----------------------------------------------------------------------
  38. #
  39. # The following options will be read by the MySQL Server. Make sure that
  40. # you have installed the server correctly (see above) so it reads this
  41. # file.
  42. #
  43. # [SERVER_TYPE]="server_type"
  44. # server_type=
  45. [mysqld]
  46. character-set-server=utf8
  47.  
  48. # The next three options are mutually exclusive to SERVER_PORT below.
  49. # [SERVER_SKIP]=""
  50. # skip-networking=
  51. # [SERVER_PIPE]=""
  52. # enable-named-pipe=
  53. # [SHARED_MEMORY]=""
  54. # shared-memory=
  55. ...

==>>>

  1. Microsoft Windows [版本 6.1.]
  2. 版权所有 (c) Microsoft Corporation。保留所有权利。
  3.  
  4. C:\Users\lfy>mysql -uroot -p
  5. Enter password: ****
  6. Welcome to the MySQL monitor. Commands end with ; or \g.
  7. Your MySQL connection id is
  8. Server version: 8.0. MySQL Community Server - GPL
  9.  
  10. Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
  11.  
  12. Oracle is a registered trademark of Oracle Corporation and/or its
  13. affiliates. Other names may be trademarks of their respective
  14. owners.
  15.  
  16. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  17.  
  18. mysql> show variables like '%char%'
  19. -> ;
  20. ERROR (): You have an error in your SQL syntax; check the manual that
  21. corresponds to your MySQL server version for the right syntax to use near ';' a
  22. t line
  23. mysql> show variables like '%char%';
  24. +--------------------------+----------------------------------------------------
  25. -----+
  26. | Variable_name | Value
  27. |
  28. +--------------------------+----------------------------------------------------
  29. -----+
  30. | character_set_client | utf8
  31. |
  32. | character_set_connection | utf8
  33. |
  34. | character_set_database | utf8mb4
  35. |
  36. | character_set_filesystem | binary
  37. |
  38. | character_set_results | utf8
  39. |
  40. | character_set_server | utf8mb4
  41. |
  42. | character_set_system | utf8
  43. |
  44. | character_sets_dir | C:\Program Files\MySQL\MySQL Server 8.0\share\chars
  45. ets\ |
  46. +--------------------------+----------------------------------------------------
  47. -----+
  48. rows in set, warning (0.13 sec)
  49.  
  50. mysql>

  1. ...
  2. # The following options will be read by MySQL client applications.
  3. # Note that only client applications shipped by MySQL are guaranteed
  4. # to read this section. If you want your own MySQL client program to
  5. # honor these values, you need to specify it as an option during the
  6. # MySQL client library initialization.
  7. #
  8. [client]
  9. default-character-set=utf8
  10.  
  11. # pipe=
  12.  
  13. # socket=MYSQL
  14.  
  15. port=
  16.  
  17. [mysql]
  18. no-beep
  19.  
  20. # default-character-set=
  21. default-character-set=utf8
  22.  
  23. # SERVER SECTION
  24. # ----------------------------------------------------------------------
  25. #
  26. # The following options will be read by the MySQL Server. Make sure that
  27. # you have installed the server correctly (see above) so it reads this
  28. # file.
  29. #
  30. # server_type=
  31. [mysqld]
  32. character-set-server=utf8
  33.  
  34. # The next three options are mutually exclusive to SERVER_PORT below.
  35. # skip-networking
  36. # enable-named-pipe
  37. # shared-memory
  38. ...

MySQL-第N篇杂记的更多相关文章

  1. 学习mysql语法--基础篇(一)

      前  言  mysql  mysql语法--本篇学习都是通过使用Navicat Premium(数据库管理工具),连接mysql数据. 本篇学习主要有两个部分:    一.创建用户,创建数据库,给 ...

  2. 学习mysql语法--基础篇(二)

      前  言  mysql  mysql语法--本篇学习都是通过使用Navicat Premium(数据库管理工具),连接mysql数据. 本篇学习主要有两个部分: [SQL语句的组成]   DML ...

  3. mysql 开发进阶篇系列 55 权限与安全(安全事项 )

    一. 操作系统层面安全 对于数据库来说,安全很重要,本章将从操作系统和数据库两个层面对mysql的安全问题进行了解. 1. 严格控制操作系统账号和权限 在数据库服务器上要严格控制操作系统的账号和权限, ...

  4. mysql 开发进阶篇系列 47 物理备份与恢复(xtrabackup 的完全备份恢复,恢复后重启失败总结)

    一. 完全备份恢复说明 xtrabackup二进制文件有一个xtrabackup --copy-back选项,它将备份复制到服务器的datadir目录下.下面是通过 --target-dir 指定完全 ...

  5. mysql 开发进阶篇系列 46 物理备份与恢复( xtrabackup的 选项说明,增加备份用户,完全备份案例)

    一. xtrabackup 选项说明 在操作xtrabackup备份与恢复之前,先看下该工具的选项,下面记录了xtrabackup二进制文件的部分命令行选项,后期把常用的选项在补上.点击查看xtrab ...

  6. mysql 开发进阶篇系列 42 逻辑备份与恢复(mysqldump 的完全恢复)

    一.概述 在作何数据库里,备份与恢复都是非常重要的.好的备份方法和备份策略将会使得数据库中的数据更加高效和安全.对于DBA来说,进行备份或恢复操作时要考虑的因素大概有如下: (1) 确定要备份的表的存 ...

  7. mysql 开发进阶篇系列 20 MySQL Server(innodb_lock_wait_timeout,innodb_support_xa,innodb _log_*)

    1. innodb_lock_wait_timeout mysql 可以自动监测行锁导致的死锁并进行相应的处理,但是对于表锁导致的死锁不能自动监测,所以该参数主要用于,出现类似情况的时候等待指定的时间 ...

  8. 小白两篇博客熟练操作MySQL 之 第一篇

    小白两篇博客熟悉操作MySQL  之   第一篇 一.概述 1. 什么是数据库? 答: 储存数据的仓库, 如: 在ATM的事例中创建的一个db 目录, 称为数据库 2. 什么是Mysql, Oracl ...

  9. 小白两篇博客熟练操作MySQL 之 第二篇

    小白两篇博客熟练操作MySQL  之   第二篇 一. 视图 视图是一个虚拟表,其本质是根据SQL语句获取动态的数据集,并为其命名,用户使用时只需使用名称即可获取结果集, 并可以将其当做表来使用. s ...

  10. 《MySQL性能优化篇》阅读笔记

    建表的时候,不要用null赋默认值,如:字符串的设置'',数据类型的设为0,不要将null设为默认值. 在MySQL中没有 full [outer] join,用union代替 各种 JOIN SQL ...

随机推荐

  1. VirtualBox中安装CentOS 7后无法上网问题

    1.在VirtualBox的设置界面,点击“网络”, 将虚拟机的“连接方式”设置为桥接模式, “界面名称”选择笔记本的无线网卡(一般是“wireless Network”的选项) 将“接入网线”勾选上 ...

  2. ubuntu移动分区,修改目录挂在点

    由于/tmp目录空间有点小,导致安装一个大软件的时候提示/tmp空间不足,最后通过创建新分区,并将新分区挂在到/tmp下,把/tmp空间扩大. 安装gparted 输入如下命令: sudo apt-g ...

  3. Sql 使用游标

    DECLARE data_cursor CURSOR FOR WITH T0 AS ( SELECT COUNT(f.DeptID) SubmitCount , f.DeptID FROM biz.F ...

  4. jpype测试报错,找不到类raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)

    最近用jpype测试java代码 公司电脑跑着没有问题,家里电脑怎么也不行,python,jdk版本啥的都一样,但总是报找不到类名的错误 raise _RUNTIMEEXCEPTION.PYEXC(& ...

  5. BZOJ1135 LYZ(POI2009) Hall定理+线段树

    做这个题之前首先要了解判定二分图有没有完备匹配的Hall定理: 那么根据Hell定理,如果任何一个X子集都能连大于等于|S|的Y子集就可以获得完备匹配,那么就是: 题目变成只要不满足上面这个条件就能得 ...

  6. php内置函数分析之ucwords()

    PHP_FUNCTION(ucwords) { zend_string *str; char *delims = " \t\r\n\f\v"; register char *r, ...

  7. alert(1) to win 5

    function escape(s) { var text = s.replace(/</g, '<').replace(/"/g, '"'); // URLs tex ...

  8. 学习旧岛小程序 (4)封装api 请求

    1.配置基本的 请求路径 和 key config.js const config = { baseUrl: 'http://bl.7yue.pro/v1/', appkey: "" ...

  9. 前端每日实战:30# 视频演示如何用纯 CSS 创作一个晃动的公告板

    效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/wjZoGV 可交互视频教程 此视频 ...

  10. python利用循环修改list内容

    写这个主意是记录一下今天遇到的问题,两种循环方式,但是只有一种可以修改list的内容 a=[1,2,3,4,5,6] for i in a: i=7 print(a) 以上这种代码a的内容不变,这里特 ...