VPS侦探论坛

标题: 数据库错误Can not connect to database [打印本页]

作者: yanqzh    时间: 2012-4-5 12:21
标题: 数据库错误Can not connect to database
军哥,求救,数据库错误

出现错误!
错误原因:Can not connect to database!
error: Access denied for user 'root'@'localhost' (using password: YES)
返 回 并修正

其他网站可以正常连接数据库,且用户名及密码均正确。
作者: yanqzh    时间: 2012-4-5 12:29
发现有时如果主站能访问,子站就会出现上面的数据库链接错误;如果主站出现502 bad gateway ,子站就能访问。
[root@li408-51 ~]# ./lnmpa status
=========================================================================
Manager for LNMPA V0.8  ,  Written by Licess
=========================================================================
LNMPA is a tool to auto-compile & install Nginx+MySQL+PHP+Apache on Linux
This script is a tool to Manage status of LNMPA
For more information please visit http://www.lnmp.org

Usage: /root/lnmpa {start|stop|reload|restart|kill|status}
=========================================================================
Nginx is runing!
/etc/init.d/httpd: line 112: lynx: command not found
SUCCESS! MySQL running (2136)
作者: yanqzh    时间: 2012-4-5 12:31
[root@li408-51 ~]# php -v
PHP 5.2.17p1 (cli) (built: Apr  5 2012 03:47:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

[root@li408-51 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
作者: yanqzh    时间: 2012-4-5 12:33
[root@li408-51 ~]# vi /usr/local/mysql/var/li408-51.err
120322 23:03:39 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
120322 23:03:39 [Note] Event Scheduler: Loaded 0 events
120322 23:03:39 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.60-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
120322 23:03:40 [Note] /usr/local/mysql/libexec/mysqld: Normal shutdown

120322 23:03:40 [Note] Event Scheduler: Purging the queue. 0 events
120322 23:03:40 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

120322 23:03:40 mysqld_safe mysqld from pid file /usr/local/mysql/var/li408-51.pid ended
120322 23:03:41 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
120322 23:03:41 [Note] Event Scheduler: Loaded 0 events
120322 23:03:41 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.60-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
120322 23:03:42 [Note] /usr/local/mysql/libexec/mysqld: Normal shutdown

120322 23:03:42 [Note] Event Scheduler: Purging the queue. 0 events
120322 23:03:42 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete
"/usr/local/mysql/var/li408-51.err" 227L, 14210C
作者: licess    时间: 2012-4-5 13:58
可能mysql密码错误,或127.0.0.1和localhost的root密码不一样
作者: yanqzh    时间: 2012-4-5 16:58
服务器里放有四个网站,都用同样的用户名及密码(任何帐户都设置了同样密码),而地址都是用localhost,其余三个都没有问题,只是第四个出现database error。诡异的是,第四个网站的数据库错误不是一直都存在的,是间段的,第四个网站与主网站的数据库都比较大,网站文件占硬盘总空间也是最大的——当主网站访问正常时,第四个网站表现为数据库错误,当第四个网站访问正常时,主网站表现为502 bad gateway。
作者: yanqzh    时间: 2012-4-5 17:00
会不会是数据库对同时间数据流量设置了限制所致?
如果是,应该如何修改?
作者: licess    时间: 2012-4-6 09:35
那就不清楚了,数据库上不可能设置流量限制




欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/) Powered by Discuz! X3.4