连接mysql数据库时,SQLSTATE[HY000] [2002] No such file or directory 的解决办法

2016-10-30 liyangweb.com 李杨 PHP


今天在用php连接MySQL的时候,遇到一个诡异的错误,错误原文是

Fatal error: Uncaught exception 'Exception' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /我的连接数据库文件路径/db.php:150 Stack trace: #0 /我的项目路径/index.php(12): medoo->__construct(Array) #1 {main} thrown in /我的连接数据库文件路径/db.php on line 150

经检查,文件存在、路径正确、配置正确,好迷茫。

最后发现是我链接数据库的时候使用的是localhost导致的问题,改成127.0.0.1就OK了。


标签: PHP

评论:

ifshaildamage
2019-02-11 12:18
<a href="http://www.injost.com/kvinders-nike-air-max-thea-gr%C3%A5-kurpesc">kvinders nike air max thea gr氓</a> <a href="http://www.wonjuvally.com/cheap-oakley-garage-rock-matte-tortoise-sunglassesc">cheap oakley garage rock matte tortoise</a> <a href="http://www.carrollgrp.com/denver-broncos-brian-dawkins-womens-ash-nike-20-nfl-t-shirt-one-color-nflr">denver broncos brian dawkins womens ash nike 20 nfl t shirt one color</a> <a href="http://www.nrastogi.com/nike-air-max-slide-slippers-2015-all-black-skoa">nike air max slide slippers 2015 all black</a> <a href="http://www.annersroofing.com/nike-free-run-2-genealogy-nike-id-sneakerf">nike free run 2 genealogy nike id</a> <a href="http://www.orderollie.com/nike-zoom-pegasus-33-billig-download-kurpesa">nike zoom pegasus 33 billig download</a>
ifshaildamage http://www.ifshaildamage.com/
rapamateur
2019-02-10 18:37
<a href="http://www.dorinsanat.com/nike-city-sabbiaal-ii-bambini-arancia-viola-chaussurese">nike city sabbiaal ii bambini arancia viola</a> <a href="http://www.hieuphamdmd.com/nike-kobe-xi-rosa-gr%C3%B8nn-r%C3%B8d-butya">nike kobe xi rosa gr酶nn r酶d</a> <a href="http://www.pascaltosi.com/air-jordan-11-gamma-blau-verkauf-schuhef">air jordan 11 gamma blau verkauf</a> <a href="http://www.sethba.com/ralph-lauren-vest-rosado-negro-polou">ralph lauren vest rosado negro</a> <a href="http://www.stevenrobins.com/air-jordan-retro-7-arancia-rosa-chaussuresa">air jordan retro 7 arancia rosa</a> <a href="http://www.syrosmusic.com/flyknit-lunar-1-oransje-bl%C3%A5-outfit-schuhed">flyknit lunar 1 oransje bl氓 outfit</a>
rapamateur http://www.rapamateur.com/
almarsecurity
2019-02-05 21:29
<a href="http://www.sousoushop.com/kvinders-nike-flyknit-lunar-2-hvid-gr%C3%A5-skol">kvinders nike flyknit lunar 2 hvid gr氓</a> <a href="http://www.rcfitcamp.com/femmes-air-jordan-cp3-noir-chaussuresq">femmes air jordan cp3 noir</a> <a href="http://www.milajerdchat.com/air-jordan-retro-12-femmes-gris-rouge-chaussuresl">air jordan retro 12 femmes gris rouge</a> <a href="http://www.girisweb.com/adidas-neo-lazy-gold-himmelblau-schuhei">adidas neo lazy gold himmelblau</a> <a href="http://www.abcmovieplot.com/dam%C3%A4nner-air-jordan-retro-5-lila-gold-schuheh">dam盲nner air jordan retro 5 lila gold</a> <a href="http://www.oldhalliwell.com/nike-lebron-13-himmelen-bl%C3%A5-bl%C3%A5-obuvj">nike lebron 13 himmelen bl氓 bl氓</a>
almarsecurity http://www.almarsecurity.com/
turkayambalaj
2019-02-04 05:15
<a href="http://www.ultimatetd.com/salomon-gcs-athletic-trail-brun-r%C3%B8d-scarpea">salomon gcs athletic trail brun r酶d</a> <a href="http://www.unvailevents.com/nike-dunk-sky-high-negro-wedge-trainers-scarpef">nike dunk sky high negro wedge trainers</a> <a href="http://www.virgocity.com/nike-zoom-structure-18-rosa-marrone-obuvd">nike zoom structure 18 rosa marrone</a> <a href="http://www.ycbrowsbeauty.com/adidas-damian-lillard-rouge-line-scarpea">adidas damian lillard rouge line</a> <a href="http://www.gfatraining.com/adidas-nitrocharge-shin-pad-bl%C3%A5-bl%C3%A5-electricity-chaussuresg">adidas nitrocharge shin pad bl氓 bl氓 electricity</a> <a href="http://www.karenannelevo.com/air-jordan-8-femmes-aqua-for-vente-bon-march%C3%A9-kurpesf">air jordan 8 femmes aqua for vente bon march茅</a>
turkayambalaj http://www.turkayambalaj.com/
ontariozillow
2019-01-25 22:23
<a href="http://www.buscochef.com/femminile-air-jordan-aero-flight-nero-obuvb">femminile air jordan aero flight nero</a> <a href="http://www.cydendressage.com/nike-kd-or-bleu-butya">nike kd or bleu</a> <a href="http://www.idlvisual.com/limited-nike-camo-womens-damarious-randall-jersey-nfl-23-cleveland-browns-2018-salute-to-service-nflu">limited nike camo womens damarious randall jersey nfl 23 cleveland browns 2018 salute to service</a> <a href="http://www.infoility.com/kobe-5-violet-jaune-version-kurpesb">kobe 5 violet jaune version</a> <a href="http://www.khoshop.com/nike-air-max-90-gs-hyper-rosa-schuhec">nike air max 90 gs hyper rosa</a> <a href="http://www.poteputi.com/nike-air-max-95-jacquard-gr%C3%A5-schuheg">nike air max 95 jacquard gr氓</a>
ontariozillow http://www.ontariozillow.com/
midatlantech
2019-01-06 11:49
<a href="http://www.bebezazou.com/ray-ban-wayfarer-deals-sunglassesr">ray ban wayfarer deals</a> <a href="http://www.nwlcenter.com/reebok-gl-6000-white-shoesv">reebok gl 6000 white</a> <a href="http://www.revarepair.com/new-balance-1500-v2-pre%C3%A7o-skow">new balance 1500 v2 pre莽o</a> <a href="http://www.makerwins.com/mackage-kay-coat-review-mackager">mackage kay coat review</a> <a href="http://www.akissilindir.com/nike-kobe-10-elite-mens-silver-black-skod">nike kobe 10 elite mens silver black</a> <a href="http://www.zeromonopolio.com/mychal-kendricks-95-jersey-usa-nflc">mychal kendricks 95 jersey usa</a>
midatlantech http://www.midatlantech.com/
imannequins
2019-01-03 03:30
<a href="http://www.dianaandwill.com/philadelphia-76ers-3-allen-iverson-white-with-red-10th-swingman-jersey-nflg">philadelphia 76ers 3 allen iverson white with red 10th swingman jersey</a> <a href="http://www.newagecharger.com/nike-free-tr-flyknit-5.0-black-blue-runningf">nike free tr flyknit 5.0 black blue</a> <a href="http://www.foliekopen.com/nfl-pittsburgh-steelers-color-rush-limited-antonio-brown-mens-football-jersey-nflv">nfl pittsburgh steelers color rush limited antonio brown mens football jersey</a> <a href="http://www.milapioffret.com/new-blance-996-kids-purple-brown-trainersa">new blance 996 kids purple brown</a> <a href="http://www.kalraslan.com/salomon-xt-hornet-trail-gr%C3%B8n-royal-sort-scarpec">salomon xt hornet trail gr酶n royal sort</a> <a href="http://www.umuttekelbayi.com/asics-gel-noosa-tri-9-rosa-arancia-kurpesc">asics gel noosa tri 9 rosa arancia</a>
imannequins http://www.imannequins.com/
printonlypros
2018-12-31 22:12
<a href="http://www.houstonujc.com/air-jordan-retro-12-blanc-dark-bleu-gris-chaussuresa">air jordan retro 12 blanc dark bleu gris</a> <a href="http://www.jetsonpress.com/asics-gel-noosa-tri-10-for-venta-australia-butya">asics gel noosa tri 10 for venta australia</a> <a href="http://www.masadablog.com/nike-roshe-run-damenn-rosa-neon-obuvc">nike roshe run damenn rosa neon</a> <a href="http://www.soknorealtor.com/air-jordan-retro-11-low-blanc-zen-gris-jam-scarpea">air jordan retro 11 low blanc zen gris jam</a> <a href="http://www.donnaemendoza.com/nike-air-yeezy-2-for-venta-barato-trick-scarpef">nike air yeezy 2 for venta barato trick</a> <a href="http://www.erneyapi.com/nike-lebron-ni%C3%B1os-plata-azul-obuvc">nike lebron ni帽os plata azul</a>
printonlypros http://www.printonlypros.com/
suchmeldungen
2018-12-29 18:01
<a href="http://www.cheapcoatsfr.com/air-max-97-for-vente-kurpesb">air max 97 for vente</a> <a href="http://www.mylinkstv.com/nike-air-more-uptempo-zapatost">nike air more uptempo</a> <a href="http://www.phxfam.com/custom-painted-converse-uk-shoesz">custom painted converse uk</a> <a href="http://www.shanibazaar.com/nike-mercurial-superfly-bl%C3%A5-pack-coupon-schuheb">nike mercurial superfly bl氓 pack coupon</a> <a href="http://www.imannequins.com/limited-nike-olive-mens-marcus-davenport-jersey-nfl-92-new-orleans-saints-2017-salute-to-service-nflu">limited nike olive mens marcus davenport jersey nfl 92 new orleans saints 2017 salute to service</a> <a href="http://www.irentevent.com/white-adidas-zx-750-skou">white adidas zx 750</a>
suchmeldungen http://www.suchmeldungen.com/
alchemaerie
2018-12-29 09:07
<a href="http://www.bladeid.com/nike-air-presto-bleu-spider-blanc-schuhea">nike air presto bleu spider blanc</a> <a href="http://www.bakomoms.com/air-max-90-lila-xanax-butye">air max 90 lila xanax</a> <a href="http://www.macrackmount.com/vibram-fivefingers-classic-cielo-blu-verde-kurpesc">vibram fivefingers classic cielo blu verde</a> <a href="http://www.martinsedacca.com/air-jordan-super-fly-v-silber-lila-butya">air jordan super fly v silber lila</a> <a href="http://www.maxibymaxi.com/air-jordan-2-marrone-arancia-schuheg">air jordan 2 marrone arancia</a> <a href="http://www.slatervision.com/flyknit-roshe-run-triple-sort-k%C3%B8be-protein-butyf">flyknit roshe run triple sort k酶be protein</a>
[url=http://www.alchemaerie.com/]alchemaerie[/url]
evenbayhout
2018-12-28 21:01
<a href="http://www.geuwompo.com/adidas-superstar-2-light-blau-shoesv">adidas superstar 2 light blau</a> <a href="http://www.partyhubuk.com/billig-nike-free-run-2-dam%C3%A4nner-blau-runninga">billig nike free run 2 dam盲nner blau</a> <a href="http://www.shahsmkj.com/ray-ban-aviator-rb3362-sunglassesr">ray ban aviator rb3362</a> <a href="http://www.wanbilm.com/reebok-gl-6000-white-shoesv">reebok gl 6000 white</a> <a href="http://www.dmmsband.com/adidas-white-casual-shoes-for-men-skow">adidas white casual shoes for men</a> <a href="http://www.playhousecash.com/mackage-phylis-coat-mackager">mackage phylis coat</a>
evenbayhout http://www.evenbayhout.com/
蔡天水
2018-01-18 21:29
博主你好 , 我也遇到这个问题, 我的数据库和程序是分别放在不同的服务器的.  现在也不解这个问题 ;  
PHP7.2 + PDO .
空灵
2017-12-31 13:24
就是这个错 恶心个人 我看在navacat都能链接,改回去就好了
flower
2017-11-02 20:15
正解!!!
你好少侠
2017-08-20 16:16
谢谢楼主的经验,和楼上一样,百度上的方法各种没用,翻到你的就好了^_^

发表评论:

Powered by emlog 冀ICP备13011830号-1