mysql不能啟動報error2013錯誤的多種解決方案
Mysql mysql lost connection to server during query 問題解決方法
緣由: 在查詢Mysql中的數(shù)據(jù)庫,或者修改比較大的表的時候就會出現(xiàn)這種情況;
google之:
方案1.在mysql配置文件[myslqd]下面添加一行設(shè)置skip-name-resolve.需要重啟mysql服務.
方案2.在hosts文件內(nèi)添加: ip與主機名的映射關(guān)系,如: 127.0.0.1 localhost. 這種方式不用重啟mysql服務.
---------------------------
三個層面上解決這個問題:
1. 代碼層面,你需要在自己的PHP數(shù)據(jù)庫連接處增加大致如下代碼。
if( in_array(mysql_errno(), array(2006, 2013))){ mysql_close(); mysql_connect(...); mysql_query(...); }
也就是說遇到2006,2013錯誤就重新連接一下MySQL。
2. MySQL層面,需要配置一些參數(shù) my.cnf (但是這里是linux下,我的windows配置怎么辦?)
wait_timeout = x 超時時間 如600秒
max_allowed_packet = y 最大允許數(shù)據(jù)量
適當增加x,y的值。
3. 一般出現(xiàn)這種情況不是所有例句而是單個表,請你先修復表一般都能解決這類問題。
----------------------
MySQL Error 2013: Lost connection to MySQL server during query
錯誤代碼: 1153 - Got a packet bigger than 'max_allowed_packet' bytes
解決方法:
修改mysql.ini(網(wǎng)上都說是這個文件,找了N久終于知道在哪里了,我的目錄是在 D:\MySQL_Data\MySQL Server 5.5 在MySQL_Data文件夾下)文件添加如下代碼即可
max_allowed_packet=500M
如果不可以的話就修改F:\program\mysql5.0\my-huge.ini
里的max_allowed_packet=16M 把16改為500 /////////////我用這個方法解決的 2014-6-4 19:58 //////////
個人理解就是把mysql配置所提供的最大允許內(nèi)存改大了畢竟16M可能不夠
我是根據(jù)此方法做的,試試
----------------------
4. 可以直接在mysql中設(shè)置:
#show variables like '%timeout%';
#show variables like 'max_allowed_packet'
set global wait_timeout=60000;
#set global max_allowed_packet = 2*1024*1024
相關(guān)文章
Mysql Error Code : 1436 Thread stack overrun
I meet with the error while calling stored procedures from the MySql in my Mac system server. It similar as the description below2011-07-07mysql數(shù)據(jù)庫單表最大存儲依據(jù)詳解
這篇文章主要為大家介紹了mysql數(shù)據(jù)庫單表最大存儲的依據(jù)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-07-07phpMyAdmin下將Excel中的數(shù)據(jù)導入MySql的圖文方法
使用phpMyAdmin將Excel中的數(shù)據(jù)導入MySql,需要將execl導入到mysql數(shù)據(jù)庫的朋友可以參考下。2010-08-08MySQL Semisynchronous Replication介紹
這篇文章主要介紹了MySQL Semisynchronous Replication介紹,本文講解了Semisynchronous Replication 定義、,需要的朋友可以參考下2015-05-05mysql按照天統(tǒng)計報表當天沒有數(shù)據(jù)填0的實現(xiàn)代碼
這篇文章主要介紹了mysql按照天統(tǒng)計報表當天沒有數(shù)據(jù)填0的實現(xiàn)方法,需要的朋友可以參考下2018-01-01mysql常用函數(shù)實例總結(jié)【聚集函數(shù)、字符串、數(shù)值、時間日期處理等】
這篇文章主要介紹了mysql常用函數(shù),結(jié)合實例形式總結(jié)分析了mysql聚集函數(shù)、字符串、數(shù)值、時間日期處理等常見函數(shù)與相關(guān)使用技巧,需要的朋友可以參考下2020-04-04