mysql_select_db不支持,警告:mysql_select_db()对用户“ @'localhost”的访问被拒绝(使用密码:NO)...

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.

My problem after the down grade is:

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

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)

Looking specifically at:

''@'localhost'

^^

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

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

Which comes before a mysql_select_db call.

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值