我必须导入1g的sql数据,我将max_allowed_packet提升到1100M以确定。
所以我使用:
我的查询
mysql -u root -p -D mainbase < GeoPC_WO.sql
但1分钟后,它在此过程中停止,我收到此错误:
**ERROR 2013 (HY000) at line 23: Lost connection to MySQL server during query
**Lost connection to MySQL server during query****
答案 0 :(得分:13)
您可能有一些大于最大大小的大型插入语句。检查/etc/mysql/my.cnf文件或其中的任何位置。不记得默认是什么 - 但将它设置为像下面这样大的东西可能会有所帮助。
这是一个选项
[mysqld]
max_allowed_packet = 16M
也许是另一种方式
[mysqldump]
max_allowed_packet = 16M
答案 1 :(得分:13)
我有完全相同的问题。经过1小时的挣扎,我通过设置
解决了这个问题net_write_timeout
更高的值(在我的情况下, 300 )
答案 2 :(得分:1)
在我的情况下,问题(“查询期间与MySQL服务器的连接失败”)是在损坏的转储文件或行为不当的硬盘驱动器中:
首先,我在主服务器上进行了转储,然后将该转储复制到复制服务器。但似乎复制服务器的硬盘存在问题,转储损坏,即主服务器上原始转储文件的MD5与复制服务器上转储副本的MD5不同。
答案 3 :(得分:0)
你可以试试这个:
首先:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Angular Material style sheet -->
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<style>
html, body {height: 100%; margin:0px !important;}
header{
position: fixed;
top: 0;
height: 50px;
width: 100%;
background-color: #777;
z-index: 1;
}
.content{
padding-top: 50px;
padding-bottom: 50px;
background-color:#ffffcc;
position: fixed;
top:0px;
bottom:0px;
width:100%;
}
footer{
background-color: #777;
position: fixed;
bottom: 0;
height: 50px;
width: 100%;
z-index: 1;
}
.contentdemoBasicUsage div.demo-content {
height: 600px; }
.contentdemoBasicUsage div[ng-controller] {
height: 100%;
padding-bottom: 15px; }
.contentdemoBasicUsage md-content {
padding: 24px;
height: calc(100% - 100px);
overflow:auto;
}
</style>
</head>
<body>
<header class="header">my header</header>
<div class="content">
<div ng-app="MyApp" class="contentdemoBasicUsage" ng-controller="AppCtrl" layout="column" ng-cloak="">
<md-toolbar class="md-warn">
<div class="md-toolbar-tools">
<h2 class="md-flex">Toolbar: md-warn</h2>
</div>
</md-toolbar>
<md-content flex="" layout-padding="">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare, cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
<p>
Ad sea dolor accusata consequuntur. Sit facete convenire reprehendunt et. Usu cu nonumy dissentiet, mei choro omnes fuisset ad. Te qui docendi accusam efficiantur, doming noster prodesset eam ei. In vel posse movet, ut convenire referrentur eum, ceteros singulis intellegam eu sit.
</p>
<p>
Sit saepe quaestio reprimique id, duo no congue nominati, cum id nobis facilisi. No est laoreet dissentias, idque consectetuer eam id. Clita possim assueverit cu his, solum virtute recteque et cum. Vel cu luptatum signiferumque, mel eu brute nostro senserit. Blandit euripidis consequat ex mei, atqui torquatos id cum, meliore luptatum ut usu. Cu zril perpetua gubergren pri. Accusamus rationibus instructior ei pro, eu nullam principes qui, reque justo omnes et quo.
</p>
<p>
Sint unum eam id. At sit fastidii theophrastus, mutat senserit repudiare et has. Atqui appareat repudiare ad nam, et ius alii incorrupte. Alii nullam libris his ei, meis aeterno at eum. Ne aeque tincidunt duo. In audire malorum mel, tamquam efficiantur has te.
</p>
<p>
Qui utamur tacimates quaestio ad, quod graece omnium ius ut. Pri ut vero debitis interpretaris, qui cu mentitum adipiscing disputationi. Voluptatum mediocritatem quo ut. Fabulas dolorem ei has, quem molestie persequeris et sit.
</p>
<p>
Est in vivendum comprehensam conclusionemque, alia cetero iriure no usu, te cibo deterruisset pro. Ludus epicurei quo id, ex cum iudicabit intellegebat. Ex modo deseruisse quo, mel noster menandri sententiae ea, duo et tritani malorum recteque. Nullam suscipit partiendo nec id, indoctum vulputate per ex. Et has enim habemus tibique. Cu latine electram cum, ridens propriae intellegat eu mea.
</p>
<p>
Duo at aliquid mnesarchum, nec ne impetus hendrerit. Ius id aeterno debitis atomorum, et sed feugait voluptua, brute tibique no vix. Eos modo esse ex, ei omittam imperdiet pro. Vel assum albucius incorrupte no. Vim viris prompta repudiare ne, vel ut viderer scripserit, dicant appetere argumentum mel ea. Eripuit feugait tincidunt pri ne, cu facilisi molestiae usu.
</p>
<p>
Qui utamur tacimates quaestio ad, quod graece omnium ius ut. Pri ut vero debitis interpretaris, qui cu mentitum adipiscing disputationi. Voluptatum mediocritatem quo ut. Fabulas dolorem ei has, quem molestie persequeris et sit.
</p>
<p>
Est in vivendum comprehensam conclusionemque, alia cetero iriure no usu, te cibo deterruisset pro. Ludus epicurei quo id, ex cum iudicabit intellegebat. Ex modo deseruisse quo, mel noster menandri sententiae ea, duo et tritani malorum recteque. Nullam suscipit partiendo nec id, indoctum vulputate per ex. Et has enim habemus tibique. Cu latine electram cum, ridens propriae intellegat eu mea.
</p>
<p>
Duo at aliquid mnesarchum, nec ne impetus hendrerit. Ius id aeterno debitis atomorum, et sed feugait voluptua, brute tibique no vix. Eos modo esse ex, ei omittam imperdiet pro. Vel assum albucius incorrupte no. Vim viris prompta repudiare ne, vel ut viderer scripserit, dicant appetere argumentum mel ea. Eripuit feugait tincidunt pri ne, cu facilisi molestiae usu.
</p>
</md-content>
</div>
</div>
<footer class="footer">my footer</footer>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license.
-->
<!-- Angular Material requires Angular.js Libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src="http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js"></script>
<!-- Angular Material Library -->
<script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<script type="text/javascript">
angular.module('MyApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache'])
.controller('AppCtrl', function($scope) {
});
</script>
</body>
</html>
然后你应该编辑这个文件:
sudo /etc/init.d/mysql stop
将以下行添加到[mysqld]部分:
sudo vi /etc/mysql/my.cnf
最后:
innodb_force_recovery = 4
(innodb_force_recovery强制启动InnoDB存储引擎。值4表示您的数据文件可能已损坏。有关详细信息,请访问:http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html)
问候。
答案 4 :(得分:0)
在我的情况下,由于缺少RAM,我试图将一个90MB的压缩sql文件导入1GB RAM vps服务器并且错误2013一直发生,直到我关闭httpd服务以释放一些内存并运行再次导入命令然后它成功了。