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?
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.
posted 7 years ago
here is my script for database connection.
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Two software engineers solve most of the world's problems in one K&R sized book