MySQL-第N篇杂记
1、数据的导入导出
2、查询结果的重定向
3、ON DUPLICATE KEY UPDATE对于指定的主键或者唯一键,insert时发生冲突则进行update操作。
4、解决MySQL中问乱码问题,分了5.7版本、8.0版本
- Microsoft Windows [版本 10.0.17763.805]
- (c) Microsoft Corporation。保留所有权利。
- C:\Users\lfy>mysql -uroot -p
- Enter password: ****
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is
- Server version: 5.7.-log MySQL Community Server (GPL)
- Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- mysql> show variables like '%char%';
- +--------------------------+---------------------------------------------------------+
- | Variable_name | Value |
- +--------------------------+---------------------------------------------------------+
- | character_set_client | utf8 |
- | character_set_connection | utf8 |
- | character_set_database | latin1 |
- | character_set_filesystem | binary |
- | character_set_results | utf8 |
- | character_set_server | latin1 |
- | character_set_system | utf8 |
- | character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\ |
- +--------------------------+---------------------------------------------------------+
- rows in set, warning (0.01 sec)
- mysql>
- ...
- # CLIENT SECTION
- # ----------------------------------------------------------------------
- #
- # The following options will be read by MySQL client applications.
- # Note that only client applications shipped by MySQL are guaranteed
- # to read this section. If you want your own MySQL client program to
- # honor these values, you need to specify it as an option during the
- # MySQL client library initialization.
- #
- [client]
- default-character-set=utf8
- # [CLIENT_PIPE]=""
- # pipe=
- # [CLIENT_SOCKET]="socket"
- # socket=
- # [CLIENT_PORT]="port"
- port=
- [mysql]
- no-beep
- # [CLIENT_DEFAULT_CHARACTER_SET]=""
- # default-character-set=
- default-character-set=utf8
- [database]
- default-character-set=utf8
- [server]
- default-character-set=utf8
- # SERVER SECTION
- # ----------------------------------------------------------------------
- #
- # The following options will be read by the MySQL Server. Make sure that
- # you have installed the server correctly (see above) so it reads this
- # file.
- #
- # [SERVER_TYPE]="server_type"
- # server_type=
- [mysqld]
- character-set-server=utf8
- # The next three options are mutually exclusive to SERVER_PORT below.
- # [SERVER_SKIP]=""
- # skip-networking=
- # [SERVER_PIPE]=""
- # enable-named-pipe=
- # [SHARED_MEMORY]=""
- # shared-memory=
- ...
==>>>
- Microsoft Windows [版本 6.1.]
- 版权所有 (c) Microsoft Corporation。保留所有权利。
- C:\Users\lfy>mysql -uroot -p
- Enter password: ****
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is
- Server version: 8.0. MySQL Community Server - GPL
- Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- mysql> show variables like '%char%';
- -> ;
- ERROR (): You have an error in your SQL syntax; check the manual that
- corresponds to your MySQL server version for the right syntax to use near ';' a
- t line
- mysql> show variables like '%char%';
- +--------------------------+----------------------------------------------------
- -----+
- | Variable_name | Value
- |
- +--------------------------+----------------------------------------------------
- -----+
- | character_set_client | utf8
- |
- | character_set_connection | utf8
- |
- | character_set_database | utf8mb4
- |
- | character_set_filesystem | binary
- |
- | character_set_results | utf8
- |
- | character_set_server | utf8mb4
- |
- | character_set_system | utf8
- |
- | character_sets_dir | C:\Program Files\MySQL\MySQL Server 8.0\share\chars
- ets\ |
- +--------------------------+----------------------------------------------------
- -----+
- rows in set, warning (0.13 sec)
- mysql>
- ...
- # The following options will be read by MySQL client applications.
- # Note that only client applications shipped by MySQL are guaranteed
- # to read this section. If you want your own MySQL client program to
- # honor these values, you need to specify it as an option during the
- # MySQL client library initialization.
- #
- [client]
- default-character-set=utf8
- # pipe=
- # socket=MYSQL
- port=
- [mysql]
- no-beep
- # default-character-set=
- default-character-set=utf8
- # SERVER SECTION
- # ----------------------------------------------------------------------
- #
- # The following options will be read by the MySQL Server. Make sure that
- # you have installed the server correctly (see above) so it reads this
- # file.
- #
- # server_type=
- [mysqld]
- character-set-server=utf8
- # The next three options are mutually exclusive to SERVER_PORT below.
- # skip-networking
- # enable-named-pipe
- # shared-memory
- ...
MySQL-第N篇杂记的更多相关文章
- 学习mysql语法--基础篇(一)
前 言 mysql mysql语法--本篇学习都是通过使用Navicat Premium(数据库管理工具),连接mysql数据. 本篇学习主要有两个部分: 一.创建用户,创建数据库,给 ...
- 学习mysql语法--基础篇(二)
前 言 mysql mysql语法--本篇学习都是通过使用Navicat Premium(数据库管理工具),连接mysql数据. 本篇学习主要有两个部分: [SQL语句的组成] DML ...
- mysql 开发进阶篇系列 55 权限与安全(安全事项 )
一. 操作系统层面安全 对于数据库来说,安全很重要,本章将从操作系统和数据库两个层面对mysql的安全问题进行了解. 1. 严格控制操作系统账号和权限 在数据库服务器上要严格控制操作系统的账号和权限, ...
- mysql 开发进阶篇系列 47 物理备份与恢复(xtrabackup 的完全备份恢复,恢复后重启失败总结)
一. 完全备份恢复说明 xtrabackup二进制文件有一个xtrabackup --copy-back选项,它将备份复制到服务器的datadir目录下.下面是通过 --target-dir 指定完全 ...
- mysql 开发进阶篇系列 46 物理备份与恢复( xtrabackup的 选项说明,增加备份用户,完全备份案例)
一. xtrabackup 选项说明 在操作xtrabackup备份与恢复之前,先看下该工具的选项,下面记录了xtrabackup二进制文件的部分命令行选项,后期把常用的选项在补上.点击查看xtrab ...
- mysql 开发进阶篇系列 42 逻辑备份与恢复(mysqldump 的完全恢复)
一.概述 在作何数据库里,备份与恢复都是非常重要的.好的备份方法和备份策略将会使得数据库中的数据更加高效和安全.对于DBA来说,进行备份或恢复操作时要考虑的因素大概有如下: (1) 确定要备份的表的存 ...
- mysql 开发进阶篇系列 20 MySQL Server(innodb_lock_wait_timeout,innodb_support_xa,innodb _log_*)
1. innodb_lock_wait_timeout mysql 可以自动监测行锁导致的死锁并进行相应的处理,但是对于表锁导致的死锁不能自动监测,所以该参数主要用于,出现类似情况的时候等待指定的时间 ...
- 小白两篇博客熟练操作MySQL 之 第一篇
小白两篇博客熟悉操作MySQL 之 第一篇 一.概述 1. 什么是数据库? 答: 储存数据的仓库, 如: 在ATM的事例中创建的一个db 目录, 称为数据库 2. 什么是Mysql, Oracl ...
- 小白两篇博客熟练操作MySQL 之 第二篇
小白两篇博客熟练操作MySQL 之 第二篇 一. 视图 视图是一个虚拟表,其本质是根据SQL语句获取动态的数据集,并为其命名,用户使用时只需使用名称即可获取结果集, 并可以将其当做表来使用. s ...
- 《MySQL性能优化篇》阅读笔记
建表的时候,不要用null赋默认值,如:字符串的设置'',数据类型的设为0,不要将null设为默认值. 在MySQL中没有 full [outer] join,用union代替 各种 JOIN SQL ...
随机推荐
- VirtualBox中安装CentOS 7后无法上网问题
1.在VirtualBox的设置界面,点击“网络”, 将虚拟机的“连接方式”设置为桥接模式, “界面名称”选择笔记本的无线网卡(一般是“wireless Network”的选项) 将“接入网线”勾选上 ...
- ubuntu移动分区,修改目录挂在点
由于/tmp目录空间有点小,导致安装一个大软件的时候提示/tmp空间不足,最后通过创建新分区,并将新分区挂在到/tmp下,把/tmp空间扩大. 安装gparted 输入如下命令: sudo apt-g ...
- Sql 使用游标
DECLARE data_cursor CURSOR FOR WITH T0 AS ( SELECT COUNT(f.DeptID) SubmitCount , f.DeptID FROM biz.F ...
- jpype测试报错,找不到类raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
最近用jpype测试java代码 公司电脑跑着没有问题,家里电脑怎么也不行,python,jdk版本啥的都一样,但总是报找不到类名的错误 raise _RUNTIMEEXCEPTION.PYEXC(& ...
- BZOJ1135 LYZ(POI2009) Hall定理+线段树
做这个题之前首先要了解判定二分图有没有完备匹配的Hall定理: 那么根据Hell定理,如果任何一个X子集都能连大于等于|S|的Y子集就可以获得完备匹配,那么就是: 题目变成只要不满足上面这个条件就能得 ...
- php内置函数分析之ucwords()
PHP_FUNCTION(ucwords) { zend_string *str; char *delims = " \t\r\n\f\v"; register char *r, ...
- alert(1) to win 5
function escape(s) { var text = s.replace(/</g, '<').replace(/"/g, '"'); // URLs tex ...
- 学习旧岛小程序 (4)封装api 请求
1.配置基本的 请求路径 和 key config.js const config = { baseUrl: 'http://bl.7yue.pro/v1/', appkey: "" ...
- 前端每日实战:30# 视频演示如何用纯 CSS 创作一个晃动的公告板
效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/wjZoGV 可交互视频教程 此视频 ...
- python利用循环修改list内容
写这个主意是记录一下今天遇到的问题,两种循环方式,但是只有一种可以修改list的内容 a=[1,2,3,4,5,6] for i in a: i=7 print(a) 以上这种代码a的内容不变,这里特 ...