国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > CMS > Wordpress > 正文

LNMP WordPress 建立數(shù)據(jù)庫(kù)連接時(shí)出錯(cuò)

2024-09-07 00:51:20
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

幫朋友的博客網(wǎng)站從apache 換成 nginx 之后wordpress 出錯(cuò)提示 “建立數(shù)據(jù)庫(kù)連接時(shí)出錯(cuò)”.

而apache 是可以正常連接,本地mysql 也可以正常登錄上去.

1、使用 mysql -uroot -p 登錄上mysql 并用 show variables like ‘socket'; 查詢(xún)mysql socket的文件存在什么地方,代碼如下:

  1. [root@iZ23482kqn1Z default]# mysql -uroot -p 
  2. Enter password 
  3.  
  4. Welcome to the MySQL monitor.  Commands end with ; or /g. 
  5.  
  6. Your MySQL connection id is 18509 
  7.  
  8. Server version: 5.1.73 MySQL Community Server (GPL) 
  9.    
  10. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 
  11.   
  12. Oracle is a registered trademark of Oracle Corporation and/or its 
  13.  
  14. affiliates. Other names may be trademarks of their respective 
  15.  
  16. owners. 
  17.    
  18. Type 'help;' or '/h' for help. Type '/c' to clear the current input statement. 
  19.    
  20. mysql> show variables like 'socket'
  21.  
  22. +---------------+-----------------+ 
  23.  
  24. | Variable_name | Value           | 
  25.  
  26. +---------------+-----------------+ 
  27.  
  28. | socket        | /tmp/mysql.sock | 
  29.  
  30. +---------------+-----------------+ 
  31.  
  32. 1 row in set (0.00 sec) 

2、編輯 /etc/php.ini 文件找到 mysql.default_socket =,修改成以下代碼:

  1. Default socket name for local MySQL connects.  If empty, uses the built-in 
  2. ; MySQL defaults. 
  3. ; http://php.net/mysql.default-socket 
  4. --Vevb.com 
  5. mysql.default_socket =/tmp/mysql.sock 

3、重起php-fpm 服務(wù)

service php-fpm restart

問(wèn)題解決.

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 东港市| 鄯善县| 洛隆县| 凤庆县| 漳州市| 平南县| 九台市| 江津市| 古丈县| 宁德市| 临猗县| 大方县| 迁安市| 昌乐县| 芷江| 明光市| 会东县| 闵行区| 简阳市| 平山县| 集安市| 扶绥县| 大竹县| 西乌| 秦皇岛市| 龙州县| 三明市| 南平市| 新河县| 永胜县| 高邮市| 秦皇岛市| 蓝山县| 金阳县| 松原市| 夏邑县| 新民市| 霍林郭勒市| 绥滨县| 盐源县| 桐柏县|