Closed Pio84 closed 4 years ago
The script uses the following command for user testing :
mysql -h <IP or hostname> -P <TCP Port> -u <user> -p<pass> -e 'show databases;'
with IP set to 127.0.0.1 if you enter nothing.
The error message comes from mysql not from the script : there is nothing I can do about it.
Example on my test server :
[root@icinga ~]# mysql -h 127.0.0.1 -P 3306 -u root -ptest -e 'show databases;'
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I think the default host value for local databases should be localhost
instead of 127.0.0.1
within the installer script.
Also check if there is an mysql user entry for root@localhost in your database.
The error message comes from mysql not from the script : there is nothing I can do about it.
perhaps some kind of stringmanipulation at stderr
?
But you are right, the wrong Errormsg comes from sql.
@Pio84 : string manipulation on error messages is a bad idea as some users may be used to (and expect) the 'incorrect' one.
@manfredw : at this stage, the script tries to login the database so there can't be any queries. About default values, I didn't see any guidelines or good practice for this : do you have any references on this ?
Added command display on error :
Enter username : root
Enter password (or press enter if no password is required) :
Connecting...ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Command sent was : mysql -h 127.0.0.1 -P 3306 -u root -ptest -e 'show databases;'
In the function add_schema_mysql() ist the output:
Connecting...ERROR 1698 (28000): Access denied for user 'root'@'localhost'
somewhat misleading. Because the input was...Enter database host [set to 127.0.0.1 if you don't enter anything] : 127.0.0.1
in my mysql database isroot@localhost
androot@127.0.0.1
not the same.the right Error should be:
Connecting...ERROR 1698 (28000): Access denied for user 'root'@'127.0.0.1'
because thats the input i gave to the script.I think its in Line 383 of the script.
Enter database host [set to 127.0.0.1 if you don't enter anything] :
ive tested with no input and with 127.0.0.1 and this is leading to the error. If i write "localhost" as input it works as it should.