简体   繁体   English

Windows Server上的php5和mysql5

[英]php5 and mysql5 on windows server

I have installed php5 and mysql5 on my server , I can login to mysql from command, but when I try to connect using php I got this error message: 我已经在服务器上安装了php5和mysql5,可以从命令登录到mysql,但是当我尝试使用php进行连接时,却收到以下错误消息:

Access denied for user 'root'@'localhost' (using password: YES)PHP Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\\HostingSpaces\\law-training\\lawtraining.ir\\wwwroot\\includes\\class.php on line 279 PHP Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in 用户'root'@'localhost'的访问被拒绝(使用密码:是)PHP警告:mysql_query()[function.mysql-query]:D中用户'ODBC'@'localhost'的访问被拒绝(使用密码:NO) :第279行PHP上的\\ HostingSpaces \\ law-training \\ lawtraining.ir \\ wwwroot \\ includes \\ class.php警告:mysql_query()[function.mysql-query]:无法在服务器中建立到服务器的链接

I dont use 'ODBC'@'localhost' in my code at all. 我根本不在代码中使用'ODBC'@'localhost'。 I check using phpmyadmin , also I can't use it and can't connect to server.I use port 3309 for mysql , and from local or remote php can't login. 我使用phpmyadmin进行检查,也无法使用它并且无法连接到服务器。我为mysql使用端口3309,并且无法从本地或远程php登录。 I use also mysql4 on this server on port 3306 and I can use it without problem. 我还在该服务器的端口3306上使用了mysql4,我可以毫无问题地使用它。 how can i fix this problem? 我该如何解决这个问题?

Thanks 谢谢

Try logging in to localhost:3309 , I think you'll find that you're running it on a non-standard port, so you need to tell PHP where to look for the server. 尝试登录localhost:3309 ,我想您会发现它是在非标准端口上运行的,因此您需要告诉PHP在哪里寻找服务器。

ie. 即。

mysql_connect("localhost:3309", "root", "mypassword");

As a sidenote, the ODBC@localhost connection is what mysql_query tries to use if there's no connection already open. 一点题外话,在ODBC@localhost连接是什么样mysql_query试图如果没有连接已开通使用。

Is this a brand new MySQL 5 installation, and you have no means to log into it? 这是全新的MySQL 5安装,您无权登录吗? You may want to reset the root password. 您可能需要重置root密码。

http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

That should enable you to access MySQL using the command line. 那应该使您能够使用命令行访问MySQL。 Then, make sure you have a root@localhost user and grant the relevant permissions to that user. 然后,确保您具有root @ localhost用户,并向该用户授予相关权限。 For example: 例如:

mysql> GRANT ALL PRIVILEGES ON . mysql>授予所有特权 TO 'root'@'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; 到'root'@'localhost'->以GRANT OPTION通过'some_pass'标识;

If the problem persists with odbc connections, make sure your odbc data access product is fully compatible with your version of MySQL 5.x 如果odbc连接仍然存在问题,请确保odbc数据访问产品与您的MySQL 5.x版本完全兼容

Regards, Netrista Khatam Technical Services Manager OpenLink Product Support 此致Netrista Khatam技术服务经理OpenLink产品支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM