Mysql: loginproblem

twinkel

Verified User
Joined
Dec 5, 2007
Messages
7
Hi all,

I've installed DA on a debian 4.0 server. I used the custombuild script for php/mysql/phpmyadmin/....

The problem now is that I have a problem with the controlpanel. I can login via commandline with root and da_admin users to mysql

But when I want to login via phpmyadmin it fails. It also fails when I wanted to make a connection via a php script.

I've got the following error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/............php on line 6 Could not connect

In the /var/log/messages I didn't found a answer. Mysql is running otherwise I shouldn't be able to login with the commandline option. I can create a database and create users through the DA panel.

Any suggestions to solve this ?

Thanks anyway for the help.
 
you must edit the file :
/var/www/html/phpmyadmin and change the
$cfg['Servers'][$i]['auth_type'] = 'primary';
to $cfg['Servers'][$i]['auth_type'] = 'http';
 
It was already set to $cfg['Servers'][$i]['auth_type'] = 'http';

It seems it's not really a phpmyadmin problem because I cannot make a mysql connection with any php script, but commandline I can login to mysql
 
yes but the user isn't there root (asume it is twinkel) although I get this message:

Access denied for user 'root'@'localhost' (using password: NO)

and this is the script I use:

PHP:
<?php
	$dbName = "twinkel";
	$dbPass = "mypass";
	$dbUserName = "twinkel";
	$host = "localhost";
	$db = mysql_connect($host, $dbUserName, $dbPass) or die ("Could not connect");
	mysql_select_db($dbName,$db);
?>


But when I login with user twinkel commandline to mysql that works.

Commandline login to mysql : it always works (after given my password ofcourse)

Login to mysql through a php script: it fails although I gave my password
 
please check php.ini and check this lines , it must be like this :
; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =
 
This is the thing I got:

PHP:
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =


I was wondering if this is maybe the problem:

I looked in the mysql database table user and I selected al the users with the following (I didn't selected here the password column) :
PHP:
mysql> select user, host from user;

This is the thing I got:

+------------------+-------------------------+
| user | host |
+------------------+-------------------------+
| root | 127.0.0.1 |
| root | myhostname.be |
| da_admin | localhost |
| root | localhost |
| twinkel_blablatest | localhost |
+------------------+-------------------------+
5 rows in set (0.00 sec)

Is it possible that this is wrong, that I have to got a user without a username but with the root password ?

I've looked in my other directadmin panel on another machine and there I see 2 users without a username (but with the same password as the rootuser):

+------+-----------------------+
| user | host |
+------+-----------------------+
| | myotherhostname.be |
| | localhost |
+------+-----------------------+
 
ok, when I change the permission of the php script to the user that I've created in the DA panel, I get this:

Access denied for user 'username'@'localhost' (using password: NO)


I don't have a user username in my databasetable mysql (DA didn't created it, where does this happen ?)
 
Back
Top