http://www.thinkphp.cn/topic/36194.html
使用tp框架 3.2.3 ,在windows上跑的时候没有任何问题,但是部署到linux系统和是哪个,就会报这个错,不知道什么原因,求大神解答
:(
SQLSTATE[HY000] [2002] No such file or directory
错误位置
FILE: /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver.class.php LINE: 109
TRACE
#0 /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver.class.php(109): E('SQLSTATE[HY000]...')
#1 /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver.class.php(1075): Think\Db\Driver->connect()
#2 /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver/Mysql.class.php(47): Think\Db\Driver->initConnect(true)
#3 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(138): Think\Db\Driver\Mysql->getFields('inkks_xin')
#4 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(126): Think\Model->flush()
#5 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(1458): Think\Model->_checkTableInfo()
#6 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(101): Think\Model->db(0, '', true)
#7 /phpstudy/www/mmm/ThinkPHP/Common/functions.php(621): Think\Model->__construct('xin', '', '')
#8 /phpstudy/www/mmm/appx/Home/Controller/IndexController.class.php(9): M('xin')
#9 [internal function]: Home\Controller\IndexController->index()
#10 /phpstudy/www/mmm/ThinkPHP/Library/Think/App.class.php(173): ReflectionMethod->invoke(object(Home\Controller\IndexController))
#11 /phpstudy/www/mmm/ThinkPHP/Library/Think/App.class.php(110): Think\App::invokeAction(object(Home\Controller\IndexController), 'index')
#12 /phpstudy/www/mmm/ThinkPHP/Library/Think/App.class.php(204): Think\App::exec()
#13 /phpstudy/www/mmm/ThinkPHP/Library/Think/Think.class.php(120): Think\App::run()
#14 /phpstudy/www/mmm/ThinkPHP/ThinkPHP.php(97): Think\Think::start()
#15 /phpstudy/www/mmm/index.php(7): require('/phpstudy/www/m...')
#16 {main}
要保证在php.ini和mysql配置文件my.conf 中,关于mysql.sock的路径的定义统一
php.ini
pdo_mysql.default_socket=/var/lib/mysql/mysql.sock
my.conf
socket=/var/lib/mysql/mysql.sock
配置中的 localhost 改成 127.0.0.1 或者其他的 ip再试试?http://www.thinkphp.cn/topic/27457.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/113503.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...