![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Mysql
harris135
这个作者很懒,什么都没留下…
展开
-
centos7 mysql数据库安装和配置
Centos7 mysql数据库安装和配置一、系统环境 yum update升级以后的系统版本为[root@yl-web yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [root@localhost /]# wget http://dev.mysql.com/get/mysql-community-releas原创 2017-06-22 23:22:36 · 301 阅读 · 0 评论 -
向mysql数据库导入脚本,出现错误 Got a packet bigger than 'max_allowed_packet' bytes
向mysql数据库导入脚本,出现错误 Got a packet bigger than 'max_allowed_packet' bytes 执行:set global max_allowed_packet=1000000000;set global net_buffer_length=1000000;原创 2017-07-11 14:38:27 · 388 阅读 · 0 评论 -
Docker安装mysql 就这么简单
Docker安装mysql 就这么简单 1 .rpm -qa|grep docker yum -y install docker2. systemctl start docker.servicechkconfig docker on3.docker run -d --name my_mysql -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=原创 2017-12-19 14:08:58 · 290 阅读 · 0 评论 -
java.sql.SQLException: null, message from server: "Host '10.11.3.67' is not allowed to connect to t
在centos7 中启动的docker容器,后台报出这个错误 ,我这是拟机中的容器连接宿主机上的mysql,这是一个常见的错误,记录下来,mysql 不允许远程连接导致的:java.sql.SQLException: null, message from server: "Host '10.11.3.67' is not allowed to connect to this MySQL se原创 2018-01-08 16:24:00 · 1234 阅读 · 0 评论 -
Docker --常用的中间件Docker启动实例命令
一、 redis docker run -d \--name redis \--restart=always \--privileged=true \-h redis \-p 6379:6379 \-v /opt/redis:/data \redis:3.2参数说明:二、mysqldocker run -d \--name mysql \--pri原创 2018-02-06 12:40:41 · 585 阅读 · 0 评论 -
Docker-MySql -- 使用mysqldump 命令备份导出mysql容器中的结构数据
1.查看当前启动的mysql运行容器docker ps 2.使用以下命令备份导出数据库中的所有表结构和数据docker exec -it mysql mysqldump -uroot -p123456 paas_portal > /cloud/sql/paas_portal.sql3.只导数据不导结构 mysqldump -t 数据库名 -uroot -p > xxx.sql...原创 2018-03-23 10:40:53 · 10136 阅读 · 3 评论 -
Docker Mysql容器--开启binlog日志
使用Docker容器也有一段时间了,主要是项目中有用到,现有需求开启用Docker容器启动的mysql数据库的binlog,以作日志记录 和数据恢复,我们了解了MySQL的binlog日志的开启方式以及binlog日志的一些原理和常用操作,我们知道,binlog有两大作用,一个是使用binlog恢复数据,另一个就是用来做主从复制。本篇笔记就是来记录如何使用开启binlog日志和做数...原创 2018-03-27 16:25:42 · 23633 阅读 · 4 评论 -
Communications link failure ,The last packet successfully received from the server was 18,903 millis
今天开发环境出现连接数据报以下错误,错误信息如下:The last packet successfully received from the server was 18,903 milliseconds ago. The last packet sent successfully to the server was 18,901 milliseconds ago.; nested exc...原创 2018-04-11 15:14:49 · 2371 阅读 · 0 评论 -
Centos7 mysqldump定时任务,对mysql定时备份数据
mysqldump_bak.sh #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH export LANG=en_US.UTF-8time="$(date +"%Y%m%d%H%M%S")"savedir=/cloud/backup原创 2017-12-20 17:04:21 · 1251 阅读 · 0 评论 -
Docker 安装mysql
准备好docker 环境1.下载 mysql的镜像 docker pull mysql:5.72.启动mysql5.7的一个容器[root@localhost ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/re原创 2017-12-20 10:45:48 · 386 阅读 · 0 评论 -
了解Mysql分区
Mysql分区一、什么是表分区通俗地讲表分区是将一大表,根据条件分割成若干个小表。MySQL5.1开始支持数据表分区了。 如:某用户表的记录超过了600万条,那么就可以根据入库日期将表分区,也可以根据所在地将表分区。当然也可根据其他的条件分区。二、为什么要对表进行分区为了改善大型表以及具有各种访问模式的表的可伸缩性,可管理性和提高数据库效率。 分区的一些优点包括: 1)、与单个磁盘转载 2017-07-07 16:22:15 · 260 阅读 · 0 评论 -
Centos7 的Docker上如何安装MySQL
1.进入Linux后,使用Docker命令下载MySQL,命令如: docker pull mysql:5.7运行该命令后,则会显示以下日志:[root@localhost ~]# docker pull mysql:5.75.7: Pulling from library/mysqlad74af05f5a2: Pull complete 0639788facc8: Pull comp原创 2017-08-04 14:39:32 · 1489 阅读 · 0 评论 -
sql查询将多个结果合并成一个字符串
1.user表:id name roles1 张三 null2 李四 null3 王五 nullrole表id name1 管理员2 业务员3 工程师user_role表user_id role_id1 12 22 33 34.查询sqlS原创 2017-09-08 18:07:59 · 33628 阅读 · 0 评论 -
sql float保留两位
people table schemaid namejob table schemaid people_id job_title salaryresultant table schemajob_title (unique) average_salary (float, 2 dp) total_people (int) total_salary (float, 2 dp)1.float原创 2017-09-26 12:14:26 · 5134 阅读 · 0 评论 -
sql rank() 根据销售次数,生成排名列
people table schemaidnamesales table schemaidpeople_idsalepriceselect p.id, p.name, count(p.id) as sale_count, Rank() over(order by count(p.id) desc) as sale_rankfrom people p, sales原创 2017-09-26 18:02:15 · 4867 阅读 · 0 评论 -
sql,用COALESCE,NULLIF对空值和null值进行处理
eusales table schemaid name price card_name card_number transaction_dateresultant table schemaid name price (greater than 50.00) card_name card_number transaction_dateSQL CODE:select id,原创 2017-09-26 18:06:22 · 2485 阅读 · 0 评论 -
UNION ALL的使用
UNION 操作符用于合并两个或多个 SELECT 语句的结果集 UNION ALL 命令和 UNION 命令几乎是等效的,不过 UNION ALL 命令会列出所有的值 UNION 结果集中的列名总是等于 UNION 中第一个 SELECT 语句中的列名SELECT '累计到目前的所有用户' item, COUNT(*) numFROM TPT_USER uUNION原创 2017-09-28 12:12:37 · 471 阅读 · 0 评论 -
sql,with as ,in的配合使用
WITH AS的含义 1.WITH AS短语,也叫做子查询部分(subquery factoring),可以让你做很多事情,定义一个SQL片断,该SQL片断会被整个SQL语句所用到。有的时候,是为了让SQL语句的可读性更高些,也有可能是在UNION ALL的不同部分,作为提供数据的部分。 2.使用WITH AS 语句可以为一个子查询语句块定义一个名称,使用这个子查询原创 2017-09-28 14:37:54 · 2117 阅读 · 0 评论 -
CROSSTAB 的使用
使用CROSSTAB实现表的行列翻转,数据的统计表1: productsid name1 Synergistic Marble Gloves2 Gorgeous Paper Table3 Awesome Wool Gloves4 Ergonomic Leather Clock5 Heavy Duty Iron Knife6 Heavy Duty Paper Sh原创 2017-09-28 15:15:33 · 5873 阅读 · 0 评论 -
Docker学习总结(33)——Docker环境下搭建 MySQL 主从复制
搭建环境Centos 7.2 64位MySQL 5.7.13Docker 1.13.1接下来,我们将会在一台服务器上安装docker,并使用docker运行三个MySQL容器,分别为一主两从。安装docker执行命令[root@VM_0_17_centos ~]# yum install docker如果有提示,一路y下去安装成功启动Docker后,查看版本[root@VM_0_17_centos...转载 2018-06-05 13:23:12 · 823 阅读 · 0 评论