警告:mysql_select_db()对用户"@'localhost"的访问被拒绝(使用密码:NO) [英] Warning: mysql_select_db() Access denied for user ''@'localhost' (using password: NO)

查看:212
本文介绍了警告:mysql_select_db()对用户"@'localhost"的访问被拒绝(使用密码:NO)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Web开发人员的新手,我需要帮助才能找出问题所在.我安装了MySQL 5.6.10,并获得了更新当前存在超过5年的网站的src的任务.这些代码均未更改,并且可以在其他开发人员本地计算机上使用.服务器正在运行5.0.51b,我只是降级到5.5.30,试图使语法错误消失.错误是在特定版本中SET OPTION SQL_BIG_SELECTS = 1已不建议使用SET SQL_BIG_SELECTS.由于服务器运行的版本,我无法更改语法.因此,我选择将版本降至5.5.30.

I am fairly new to web dev and I am in need of help trying to find out what the problem is. I had an install of MySQL 5.6.10 and I was given a task to update the src of a website that is currently live for past 5 years. None of the code has changed and it works for the other devs local machine. The server is running 5.0.51b and I just downgraded to 5.5.30 trying to get a syntax error to go away. The error was the SET OPTION SQL_BIG_SELECTS=1 was deprecated to SET SQL_BIG_SELECTS in a certain version. I am unable to change the syntax due to the version the server runs. So I chose to down version to 5.5.30.

降级后我的问题是:

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user
''@'localhost' (using password: NO) in C:\Program Files (x86)\Apache Software
Foundation\Apache2.2\htdocs\****\src\www\include\func\func.db.php on line 47

我使用MySQL Workbench进行连接,没有连接,或者用户没有与之关联的密码.我还有另一个不在本地运行的项目,该项目可以从本地主机正常运行.我的vhost和host文件都具有正确的语法才能正常工作(已在其他项目中验证).所有这些都正常工作,并且昨天可以通过vhost调出页面.我对设置索引页的方式没有任何问题.唯一的问题是MySQL版本问题.我该怎么做才能解决此问题?我尝试在工作台中重新创建连接,甚至删除所有实例并重新创建它们.我感到难过.任何帮助将不胜感激.

I use MySQL Workbench for my connections none of the connections or users have passwords associated with them. I have another project that is not live that works fine from the localhost. My vhost and host files all have the proper syntax for this to work (verified with the other project). This all worked properly and was able to bring up the pages through vhost just fine yesterday. I never had any issues with how it was all setup to pull the index page. The only problem was the MySQL version issues. What can I do to fix this problem? I have tried recreating connections in the workbench and even deleting all the instances and recreating them. I am stumped. Any help would be greatly appreciated.

推荐答案

仔细查看您的错误,您会发现它在告诉您什么地方出了错(通常是针对哪些错误报告):

Looking closely at your error you can see that it's telling you what is wrong (typically what error reports are for):

Access denied for user
''@'localhost' (using password: NO)

特别关注:

''@'localhost'
^^

您看到没有指定用户.您需要指定希望连接的用户.

You see that no user was specified. You need to specify the user you wish to connect as.

mysql_connect("HOST","USER","PASSWORD")

哪个在mysql_select_db通话之前出现.

MySQL Connect & MySQL Select DB

注意::由于MySQL_ *功能已被弃用,请勿升级到PHP 5.5.我之所以这样说,是因为您不想更改任何代码.

NOTICE: Don't upgrade to PHP 5.5 for MySQL_* functions have been deprecated. I say this since you do not wish to change any code.

这篇关于警告:mysql_select_db()对用户"@'localhost"的访问被拒绝(使用密码:NO)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆