yanqzh 发表于 2012-4-5 12:21:13

数据库错误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:08

发现有时如果主站能访问,子站就会出现上面的数据库链接错误;如果主站出现502 bad gateway ,子站就能访问。
# ./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:33

# php -v
PHP 5.2.17p1 (cli) (built: Apr5 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

# /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:28

# 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 Event Scheduler: Loaded 0 events
120322 23:03:39 /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.60-log'socket: '/tmp/mysql.sock'port: 3306Source distribution
120322 23:03:40 /usr/local/mysql/libexec/mysqld: Normal shutdown

120322 23:03:40 Event Scheduler: Purging the queue. 0 events
120322 23:03:40 /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 Event Scheduler: Loaded 0 events
120322 23:03:41 /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.60-log'socket: '/tmp/mysql.sock'port: 3306Source distribution
120322 23:03:42 /usr/local/mysql/libexec/mysqld: Normal shutdown

120322 23:03:42 Event Scheduler: Purging the queue. 0 events
120322 23:03:42 /usr/local/mysql/libexec/mysqld: Shutdown complete
"/usr/local/mysql/var/li408-51.err" 227L, 14210C

licess 发表于 2012-4-5 13:58:44

可能mysql密码错误,或127.0.0.1和localhost的root密码不一样

yanqzh 发表于 2012-4-5 16:58:18

服务器里放有四个网站,都用同样的用户名及密码(任何帐户都设置了同样密码),而地址都是用localhost,其余三个都没有问题,只是第四个出现database error。诡异的是,第四个网站的数据库错误不是一直都存在的,是间段的,第四个网站与主网站的数据库都比较大,网站文件占硬盘总空间也是最大的——当主网站访问正常时,第四个网站表现为数据库错误,当第四个网站访问正常时,主网站表现为502 bad gateway。

yanqzh 发表于 2012-4-5 17:00:12

会不会是数据库对同时间数据流量设置了限制所致?
如果是,应该如何修改?

licess 发表于 2012-4-6 09:35:09

那就不清楚了,数据库上不可能设置流量限制
页: [1]
查看完整版本: 数据库错误Can not connect to database