Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem php with mysql

 
Zac Vincent
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new here and I do not know where to put my questions and problems regarding php and mysql. I recently installed php 5 and mysql 5.5 and apache web server individually on my windows 7 operating system. I also intalled netbean ide. So far without database, my php file will work. For example <?php echo phpinfo(); ?> will work. But when I try to connect my php file with the database , it fails. In my netbean ide, I tried to test connection but it fails and shows the following errors......

Cannot establish a connection to jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=convertToNull using com.mysql.jdbc.Driver (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)


My server host name is localhost.
server port number is 3306
username is root
and password ="".

Could anyone identify the problems I am having? I do understand there is an easy way of installing WAMP using XAMPP. But I want to try to do the another way. Another question .... Should mysql be installed inside the web server or outside or as separate location?

Thanks in advance.

Zac
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is mysql running? Can you connect to mysql usinf the command line mysql tool?
 
Zac Vincent
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is running. I can see my databases there. I usually see it in the mysql command line console.

Thank you.
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then I'm stumped as to why NetBeans cannot communicate with MySQL. Accodring to you, all of the conditions have been met: MySQL is urnning on the same maching as NetBeasn and opened port 3306, and I assume you used hte correct username and password. And since it is localhost there are no firewall issues (that happens only for remote servers). How confortable are you with Java? Could you write a simple Java app to connect to the database, and if so, does that work.

Let's look at the PHP code instead - could you post the code you use to access MySQL.
 
Zac Vincent
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my script for database connection.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic