Solo  当前访客:4 登录 注册

喧哗博客-http://blog.xuahua.com

繁华过后的沉寂--技术经验分享
浏览次数: 94,390    文章总数: 91    评论总数: 3
标签:

Got an error reading communication packets 有更新!

 

具体表现

2016-08-11T17:34:01.264286Z 36668 [Note] Aborted connection 36668 to db: 'game' user: 'game28' host: 'localhost' (Got an error reading communication packets)
2016-08-11T17:34:01.264335Z 36672 [Note] Aborted connection 36672 to db: 'game' user: 'game28' host: 'localhost' (Got an error reading communication packets)
2016-08-11T17:34:01.264337Z 36671 [Note] Aborted connection 36671 to db: 'game' user: 'game28' host: 'localhost' (Got an error reading communication packets)
2016-08-11T17:35:01.424325Z 36678 [Note] Aborted connection 36678 to db: 'xx' user: 'xx' host: 'localhost' (Got an error reading communication packets)
2016-08-11T17:35:01.424335Z 36679 [Note] Aborted connection 36679 to db: 'xx' user: 'xx' host: 'localhost' (Got an error reading communication packets)
2016-08-11T17:35:01.424372Z 36685 [Note] Aborted connection 36685 to db: 'x' user: 'xx' host: 'localhost' (Got an error reading communication packets)
2016-08-11T17:35:01.424343Z 36680 [Note] Aborted connection 36680 to db: 'xx' user: 'xx' host: 'localhost' (Got an error reading communication packets 

解决方法

在my.cnf 文件中,增加 max_allowed_packet =256M

 原因 

http://dev.mysql.com/doc/refman/5.7/en/communication-errors.html

The max_allowed_packet variable value is too small or queries require more memory than you have allocated for mysqld

翻译出来就是,服务器端设定max_allowed_packet的值太小或者查询要求的缓冲内存区比mysqld设定的要大。

 

 

 

mysql5.7在windows上面的布署安装

一,windows安装布署
 
1,MySQL安装文件分为两种,一种是msi格式的,一种是zip格式的。如果是msi格式的可以直接点击安装,按照它给出的安装提示进行安装(相信大家的英文可以看懂英文提示),一般MySQL将会安装在C:\Program Files\MySQL\MySQL Server 5.6 该目录中;zip格式是自己解压,解压缩之后其实MySQL就可以使用了,但是要进行配置
 
2,配置环境变量:
 
 

我的电脑->属性->高级->环境变量

选择PATH,在其后面添加: 你的mysql bin文件夹的路径 (如:C:\Program Files\MySQL\MySQL Server 5.6\bin )

PATH=.......;C:\Program Files\MySQL\MySQL Server 5.6\bin (注意是追加,不是覆盖)

3,修改一下配置文件

 

mysql-5.6.1X默认的配置文件是在C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini,或者自己建立一个my.ini文件,

在其中修改或添加配置(如图): 

[mysqld] 

basedir=C:\Program Files\MySQL\MySQL Server 5.6(mysql所在目录) 

datadir=C:\Program Files\MySQL\MySQL Server 5.6\data (mysql所在目录\data)

4,以管理员身份运行cmd

输入mysqld -install(如果不用管理员身份运行,将会因为权限不够而出现错误:Install/Remove of the Service Denied!) 

net start mysql

net stop mysql


 

三,liunx修改重置mysql root密码

 

1,停止 /etc/init.d/mysql stop

> mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

>mysql -uroot mysql

>update user set password=PASSWORD('root123456') where user='root';

>flush privileges;

>quit;

>/etc/init.d/mysql  restart

 

四 windows修改重置 mysql root密码

Windows:

1. 管理员登陆系统,停止mysql服务或者结束mysqld-nt进程
2. 进入命令行,来到mysql的安装目录.假设安装目录为 d:\mysql\ , CMD进入命令行
3. 运行 d:\mysql\bin\mysqld start--skip-grant-tables  --skip-networking  启动mysql,关闭权限的检查

4,>mysql -u root 

5,alter user 'root'@'localhost' identified by 'root123456'; flush privileges;

6. 重新启动mysql服务

 

 

五,创建数据库

UTF-8

 

CREATE DATABASE blog DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

GBK

create database blog DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
 
六,创建用户
 >create user 'test'@'%' identified by '123456';
 
七,赋权限

grant all privileges on *.* to joe@localhost identified by '1';

    flush privileges;

liunx下mysq5.7-布署安装

一,liunx安装布署
 
>wget 
>tar mysql-5.7.17-linux-glibc2.5-i686.tar.gz
>cp -r  mysql-5.7.17-linux-glibc2.5-i686 /usr/local/mysql 
   
 2,   加系统mysql组和mysql用户:
>groupadd mysql
>useradd -r -g mysql mysql
> cd /usr/local/mysql

 3,  创建数据库数据存储目录

>mkdir /usr/local/mysql/data

4, 修改当前目录拥有者为mysql用户

> chown -R mysql:mysql ./

5, 修改配置文件 mysql.server

>vi support-files/mysql.server

配置 basedir=/usr/local/mysql

      datadir=/usr/local/mysql/data

log-err=/usr/local/mysql/logs

6,添加开机启动:执行命令

>cp support-files/mysql.server /etc/init.d/mysqld

修改配置文件

  >suport-files/my-default.cnf

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

port=3306

innodb_buffer_pool_size = 128M

character_set_server=utf8
init_connect='SET NAMES utf8'
 
7,复制文件到 安装目录
>cp support-files/my-default.cnf ../my.cnf
 
8 ,此步骤必须先执行,初始化数据库
>cd /usr/local/mysql/bin
>mysqld --intialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &
 

9 ,启动mysql服务:

>/etc/init.d/mysqld --user=mysql

看到mysql服务说明启动成功

>ps -ef|grep mysql

 

公告

喧哗博客--繁华过后的沉寂--技术经验分享^-^
Copyright (c) 2009-2019, b3log.org & hacpai.com