Unable to login to MySql

nbn

Verified User
Joined
Feb 1, 2005
Messages
11
when I tried to create my first MySql Database, I used the DA user, to create a new user and db.
These I can see in MySql when I am logged in as da_admin. (select user, host from user)

However, when I try to connect:
mysql -u theline_chat -h localhost -p

It keeps replying with (1045) access denied for user 'theline_chat'@'localhost' (using password: YES)

I cant login either using phpMyAdmin.

I have tried multiple options for hostname, however mysql tables contains only localhost.

How do I investigate this. I cannot seem to find any error messages anywhere?

help appreciated
 

jmstacey

Verified User
Joined
Feb 12, 2004
Messages
4,107
Location
Colorado
try just mysql -uUsername -pPassword droping the localhost part and the spaces between the username and password.
If you still can't login with da_admin and the password frounde in /usr/local/directadmin/conf/mysql.conf then you might be locked out. I don't know how to recover from root lockout (if it's even possible). So you might have to restore the default basic MySQL permissions database.
 

nbn

Verified User
Joined
Feb 1, 2005
Messages
11
Let me rephrase the question:

Any OTHER account I create does not work. I'm not a newbie, and omitting spaces makes ZERO difference. I have tried multiple hostnames (and without), but with same result. user table states localhost anyhow.

Heres a use-case to investigate...

Pseudo-transcript:
mysql>select host, user, password from user;

localhost theline_chat *3D3B92F24203336

mysql> update user set password=password('abc') where user='theline_chat';

mysql>\q

[root@server ~]# mysqladmin -u da_admin -h localhost -p reload
Enter password:
[root@server ~]# mysql -u theline_chat -h localhost -p
Enter password:abc
ERROR 1045 : Access denied for user 'theline_chat '@' localhost' (using password: YES)
 

nbn

Verified User
Joined
Feb 1, 2005
Messages
11
Found the answer myself..

It seems that prior to version 4.1, the PASSWD function returned a 16 bytes hashcode, but as of version 4.1 it has expanded into a 41 byte password.

This can be seen when issuing a select user, password from user, and count the number of characters in the password.

According to mysql documentation, you would have to run mysql_fix_privilege_tables, which at least in my case fixed it.

I still had to create new passwords, but now the were 41 bytes.

I wonder why this setting has been garbled.
 

nbn

Verified User
Joined
Feb 1, 2005
Messages
11
Now, it that was some public url I could easily find, I might not have been stopped for so long...

However, I did not upgrade, I installed DA just 2 days before, and did not recompile apache/upgrade mysql.

Running the fix has helped , and could easily be executed at the last stage of install...
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,919
Hello,

I'd like to know one thing: Did the fresh 4.1.x install setup the old 4.0.x databases (with short passwords)? I can easily add the fix to the installer, but I'm a bit confused as to why on earth mysql 4.1 would setup the 4.0 password length. A bit odd..

John
 

nbn

Verified User
Joined
Feb 1, 2005
Messages
11
It was pretty much a fresh install on fedora core 3 with x86.

I had just created my first hosting site, and needed to setup the first db, when it could not log in.

Remembering now, the root mysqlpassword, the da_admin password were all 41 bytes in user table, but the new user and dbuser were both 16 bytes.

So apparently when creating the mysql and da_admin it did work properly, and perhaps something or other might have interfered.

I cannot start from scratch again, so I will not be able to investigate further..

Anyway, perhaps it would be possible to make a script to perform the check when finishing install : 'select password('da_rulez');' and look at the result.
 
Top