Hello everybody,

I have a problem with my mysql-server, at least, I think... This is the problem :
I use aptana as my editor, in which I have installed QuantumDB as plugin. This allows me to quickly update or delete or insert data in my MySQL-database without having to leave my editor.
Using this plugin, I get all the information I ask for, or do all the actions on my database I want to. But when I put the mysql-statements in a php-script (= still in aptana), and run it in my browser (firefox), I first get the message "connecting with localhost", which changes to "waiting for localhost" and that's it.
The browser is "waiting for localhost" approximatly 1 minute (default-setting) and than shows me all the echo-statements I just before the database-connection-statement. Even if I use the die()-function with the mysqli_error-function, to find out what the problem is, I get no output on that.
When I change the database-host (in which case I know for sure that the host is wrong), I get no response.
Can anybody help me on this ?


It would really help if your could post part of the code giving you the problem. In the mean time have you tried your sql statement from the command line with the mysql interface? Login as the user you have defined in your script and try the code.

echo 'before the mysqli_connect-statement...';
$dbc = mysqli_connect('localhost', 'root', 'juist', 'fietsen') or die(mysqli_error($dbc));
$query = "SELECT * FROM fietsen";
$data = mysqli_query($dbc, $query) or die(mysqli_error($dbc));
while ($row[$i] = mysqli_fetch_array($data)) {
	echo 'gegeven : '.$row[$i]['naam'].'  '.$row[$i]['omschrijving']. '<br />';
echo 'after the mysqli-statements...';

The script above results in the first echo and that's all. It is like it has trouble connecting with the mysql-server. Funny thing is : I don't get a error-message from the mysqli_error, not even when I change 'localhost' in something else... which is definitly strange...
In the QuantumDB-perspective, it connects, and I get my results...(I do not have to leave my editor to do so...)
If I run the sql-statement in my MySQL-Workbench, I get the results.

What I'm thinking now, is : I have also a xampp installed on my computer. Could that cause this behaviour ?

What if you run it from the command line? In workbentch (and I will bet in QuantumDB) you manually connect to a database first through the GUI and stay connected till you disconnect. Try testing it from the command line. Get to a command prompt (Windows) or bash shell (Linux) and enter:

mysql -u root@localhost -p<root mysql password> <Database name>

If you connect then the login you are using is correct so next try your select query and see if it runs. If you do not connect then the problem is in your login to the server. **Note that there IS A SPACE between the -u and user name but NO SPACE between the -p and the password.

I have a connection.
If I run it from the command line, I get this :

C:\Users\Geert\mysql -u root -pjuist fietsen
Welcome to the MySQL monitor.  Commands end with ; or \g.
Server version: 5.1.46-community MySQL Community Server (GPL)

and than a bit more about copyright.
Then I run my select-query and I get my results... So far so good...

It may or may not be the problem but you changed the command line I suggested. You are not specifying the server IP or name in yours. Try this and see what happens:


C:\Users\Geert\mysql -u root@localhost -pjuist fietsen


C:\Users\Geert\mysql -u root -pjuist fietsen

The first one is what php is sending vs the second which could default to instead of localhost. You probably have the user root@ in the mysql users table but if you don't have root@localhost then no connection.

Or I could be wrong but I know it once gave me fits. If it works just fine we need to figure out where else it could be dying... Have you looked at the mysql log or the httpd access and error logs for the results of the script?

You are right :
C:\Users\Geert\mysql -u root@localhost -pjuist fietsen does not make a connection ;
I get the warning "ERROR 1045 (28000):
Access denied for user 'root@localhost'@'localhost' <using password:YES>"
And this may sound a bit silly, but I don't seem to find the httpd access and error logs.
Where can I find the logs ?

The connection is made !
Not localhost, but made the connection.
rch1231, thanks a lot for helping me out here. It is clear that I have a lot to learn.
What I don't understand in this is why the mysqli_error didn't gave a warning ? It was really in the connection that there was a error ?
Thanks for helping !


My fault on the httpd logs if your on a windows system with IIS it will be in the IIS logs. httpd access and error logs are for Apache on either Windows or Linux.

On the question about why you did not see an error message when it did not connect, it probably did give a warning but you may not have set up the any code to post the warning to a field and display it so you did not see it. Does that make sense?

Glad you got the connection working.