PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 18th, 2006, 10:27 AM
jagguy jagguy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 jagguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php install with mysql

Hi

I have latest stable release of php,apache,mysql but I can't conncect between mysql with php on apache.

I can create a database and tables with command prompt in mysql.

On the php info script test mysql appears.
I try to access a database with php from mysql.

php Code:
Original - php Code
  1.  
  2.  
  3. $dbhost = 'localhost';
  4.  
  5. $conn = mysql_connect($dbhost);
  6.  
  7.  
  8. $dbname = 'petstore';
  9. mysql_select_db($dbname);



The errors I get is

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in Crogram FilesApache GroupApache2htdocsmyone2.php on line 5

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in Crogram FilesApache GroupApache2htdocsmyone2.php on line 9

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in Crogram FilesApache GroupApache2htdocsmyone2.php on line 9Is my setup wrong?

Reply With Quote
  #2  
Old September 18th, 2006, 01:25 PM
Kayosz Kayosz is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 25 Kayosz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 2 sec
Reputation Power: 0
RE: php install with mysql

Yup. Setup is wrong. Nah just joking.

I assume that you have a MySQL username and password.

If so, your code should look like this:

php Code:
Original - php Code
  1.  
  2.  
  3. $dbhost = 'localhost';
  4. $user = "root"; //Or whatever
  5. $password = "password"; //Or whatever
  6.  
  7. $conn = mysql_connect($dbhost,$user,$password);
  8.  
  9.  
  10. $dbname = 'petstore';
  11. mysql_select_db($dbname);
  12. ?>
  13.  


As you can see, to connect with php to MySQL you need the host, username and password.

Hope this helps.


Reply With Quote
  #3  
Old September 18th, 2006, 11:20 PM
jagguy jagguy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 jagguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: php install with mysql

q) I don't have a username or password setup and I don't want one either. Where do I effect the username/password?

q)When I do the server instance wizard (mysql)the security part fails on me as it claims port 3363 on is not open and to check the firewall, does this effect php ?

Reply With Quote
  #4  
Old September 19th, 2006, 04:51 AM
Kayosz Kayosz is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 25 Kayosz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 2 sec
Reputation Power: 0
RE: php install with mysql

A) A password is not necessary, but you still need a user. Run winmysqladmin.exe to setup user (or server instance wizard).

A) It does not effect php much but MySQL gets whacked since it uses a port. Windows XP SP2 is very picky about security. Click start >> control panel >> Windows firewall. Click the Exceptions tab and click on "Add Port...". Type MySQL as the name and 3363 as the port number. Leave selection at TCP. Click OK. Click OK again. Windows should now not complain about port 3363.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > php install with mysql


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway