Mysql --- Access denied for user 'test'@'localhost'
Hello,
I'm trying to install zabbix on my sandbox server and I'm stacked on the mysql stuff. 9024:20080731:173122 **** Enabled features **** 9024:20080731:173122 SNMP monitoring: YES 9024:20080731:173122 WEB monitoring: YES 9024:20080731:173122 Jabber notifications: YES 9024:20080731:173122 ************************** 9024:20080731:173122 Failed to connect to database: Error: Access denied for user 'zabbix'@'localhost' (using password: YES) [1045] (Bold is mine) I keep having the same error message if I access through $mysql -u zabbix -p Has anyone here solved this issue before? Many thanks. |
Well, is this user setup in the database and did you configure it with a password on the localhost?
|
Quote:
I can access the mysql through the shell, but it does not use the password. Code:
Don't understand, because if I set the password on the zabbix config file to 'nothing' it does not log in when I do /etc/init.d/zabbix start :/ What should I check? Thanks. |
I have also re set the zabbix password, but nothing.
Code:
# mysql -u root -p What else can I do? Thanks. |
Check the syntax for MySQL 5:
http://dev.mysql.com/doc/refman/5.0/...-password.html As MySQL root user try: mysql>SET PASSWORD FOR 'zabbix'@'localhost' = PASSWORD('z4bb1x'); |
Quote:
Thanks, but I can't. mysql> SET PASSWORD FOR 'zabbix'@'localhost' = PASSWORD('z4bb1x'); ERROR 1133 (42000): Can't find any matching row in the user table mysql> select User,Password from user; +----------------+------------------+ | User | Password | +----------------+------------------+ | root | 7db8c0e24ed909d4 | | root | 7db8c0e24ed909d4 | | | | | | | | 20203dmediasql | 1a0831a150e52962 | | zabbix | 107342234bff3223 | | test | 378b243e220ea493 | +----------------+------------------+ 7 rows in set (0.00 sec) mysql> I really don't understand it. Thanks. |
Try
Code:
SET PASSWORD FOR 'zabbix' = PASSWORD('z4bb1x'); |
From the error message you posted it's not finding zabbix@localhost in your users table so you can't set a password for it nor can you log in using it.
Try creating zabbix@localhost, setting a password for it and logging in. |
See the examples here: http://dev.mysql.com/doc/refman/5.0/en/grant.html
Note that user accts are defined by where they are allowed to login from, so zabbix@localhost is a different user/acct to zabbix@myhost (for example). |
You know... I had a similar problem with my mysql... for the life of me I can't remember what the problem was. I know I eventually had to recreate the user and redo the password... I wish I took notes.
|
Can't anyone notice the obvious?
Code:
mysql> update user set password=PASSWORD("z4bb1x") where User='zabbix'; Code:
update user set Password=password('z4bb1x') where User='zabbix'; Code:
Rows matched: 1 Changed: 1 Warnings: 0 |
Look at "select Host, User, Password FROM user";
There are two things that can trip you up. If you are on host "permalac", your domain name may be included when you log in, so you may need an entry for "permalac.zybbix" for example. This should match the denied message that you see. However in your case, the user is logging in from 'localhost' and this isn't the problem. Another thing to look for is an earlier matching entry that has a different password or no password. I think it it occurs first in the User table, that is what will be tried. Anyway, look for an additional entry for the 'zabbix' user that has wild cards or the hostname of the computer that mysql is running on. Two things I thought I'd mention. You might want to delete the anonymous account. Also, you don't need to su to root to log into mysql as the root user. The -u option will do that. |
Hey, many thanks, some of you were on the good way.
The thing was that I was trying to log in with 'zabbix'@'localhost' , and the only existing zabbix was 'zabbix'@'' , and is not the same. What I've done is create another zabbix, I know is not the best way, but I've learned something about mysql, and this is the point. Code:
insert into user (Host,User,Password) values ('localhost','zabbix',PASSWORD('z4bb1x')); |
My fix
Maybe this will help someone with the same issue:
I fixed this by going into /etc/zabbix/zabbix_server.conf. It had set a random password (I believe during setup). zabbix-server apparently doesn't take the password from any of the other files, it pulls it directly from here. # Database host name # Default is localhost DBHost=localhost # Database name # SQLite3 note: path to database file must be provided. DBUser and DBPassword are ignored. DBName=zabbix # Database user DBUser=zabbix # Database password # Comment this line if no password used DBPassword=pass |
|
All times are GMT -5. The time now is 12:26 AM. |