php 串連mysql 錯誤排查一例

來源:互聯網
上載者:User

標籤:php   mysql   串連錯誤   

php後台接不上mysql資料庫,查看phpinfo,mysql驅動正常。

查看日誌 

650) this.width=650;" src="https://s3.51cto.com/wyfs02/M01/9D/70/wKioL1mALB-ykR1IAAAipn-2nrs045.png-wh_500x0-wm_3-wmp_4-s_2710672881.png" title="QQ20170801152132.png" alt="wKioL1mALB-ykR1IAAAipn-2nrs045.png-wh_50" />

發現配置正確,串連被拒,猜想可能是使用者權限的問題

進入資料庫查看使用者和許可權 

[[email protected] wezchina]# mysql -h 192.168.2.100 -P 3306 -uSbsBL6tnULzkI21 -pEnter password: ERROR 1045 (28000): Access denied for user ‘user‘@‘MyCloudServer‘ (using password: YES)[[email protected] wezchina]# mysql -u root -p發現ip地址被解析為主機名稱並被拒
mysql> select user,host from mysql.user;+-----------------+---------------+| user            | host          |+-----------------+---------------+| SbsBL6tnULzkI21 | %             || root            | 127.0.0.1     || SbsBL6tnULzkI21 | 192.168.2.*   || root            | ::1           ||                 | localhost     || SbsBL6tnULzkI21 | localhost     || root            | localhost     ||                 | mycloudserver || SbsBL6tnULzkI21 | mycloudserver || root            | mycloudserver |+-----------------+---------------+10 rows in set (0.00 sec)查看使用者host,發現主機名稱是小寫在/etc/hosts檔案添加以下解析192.168.2.100 mycloudserver MyCloudServer登入 正常


本文出自 “10850395” 部落格,請務必保留此出處http://10860395.blog.51cto.com/10850395/1952668

php 串連mysql 錯誤排查一例

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.