LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 07-31-2008, 11:35 AM   #1
permalac
Member
 
Registered: Jul 2007
Location: Barcelona
Posts: 115

Rep: Reputation: 16
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.
 
Old 07-31-2008, 02:06 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Well, is this user setup in the database and did you configure it with a password on the localhost?
 
Old 08-01-2008, 04:51 AM   #3
permalac
Member
 
Registered: Jul 2007
Location: Barcelona
Posts: 115

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by trickykid View Post
Well, is this user setup in the database and did you configure it with a password on the localhost?
Yes, there is a mysql user called 'zabbix' , with all the rights on the database 'zabbix'.

I can access the mysql through the shell, but it does not use the password.
Code:
[root@ocata4888 exploits]# mysql -u zabbix
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 410 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> set password = password("z4bbix");
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql>

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.
 
Old 08-01-2008, 04:55 AM   #4
permalac
Member
 
Registered: Jul 2007
Location: Barcelona
Posts: 115

Original Poster
Rep: Reputation: 16
I have also re set the zabbix password, but nothing.


Code:
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 413 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql> update user set password=PASSWORD("z4bb1x") where User='zabbix';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
# mysql -u zabbix -p
Enter password:
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)


What else can I do?


Thanks.
 
Old 08-01-2008, 09:26 PM   #5
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
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');
 
Old 08-04-2008, 05:09 AM   #6
permalac
Member
 
Registered: Jul 2007
Location: Barcelona
Posts: 115

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by sleddog View Post
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');

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.
 
Old 08-04-2008, 05:14 AM   #7
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
Try
Code:
SET PASSWORD FOR 'zabbix' = PASSWORD('z4bb1x');
 
Old 08-04-2008, 09:22 AM   #8
Phil-B
LQ Newbie
 
Registered: May 2007
Location: UK
Distribution: Redhat variants
Posts: 10

Rep: Reputation: 0
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.
 
Old 08-04-2008, 09:26 AM   #9
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
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).
 
Old 08-04-2008, 10:04 AM   #10
checkmate3001
Member
 
Registered: Sep 2007
Location: Folsom, California
Distribution: Debian 4.0 (Etch), Debian 5.0 (Lenny), Ubuntu 8.04
Posts: 301

Rep: Reputation: 32
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.
 
Old 08-04-2008, 10:12 AM   #11
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Can't anyone notice the obvious?

Code:
mysql> update user set password=PASSWORD("z4bb1x") where User='zabbix';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0
Try changing that line to:

Code:
update user set Password=password('z4bb1x') where User='zabbix';
flush privileges;
Make sure it then prints out something like this:

Code:
Rows matched: 1  Changed: 1  Warnings: 0
Previously it never changed anything cause PASSWORD should be all lowercase and password column is actually Password, not all lowercase. Also, only put single ticks around the password, you had it somewhat correct but the following syntax I gave you should work with MySQL 5.x.

Last edited by trickykid; 08-04-2008 at 10:14 AM.
 
Old 08-04-2008, 10:17 AM   #12
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
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.
 
Old 08-05-2008, 03:45 AM   #13
permalac
Member
 
Registered: Jul 2007
Location: Barcelona
Posts: 115

Original Poster
Rep: Reputation: 16
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'));
 
Old 01-18-2012, 05:05 PM   #14
rs232c
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
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
 
Old 03-05-2013, 07:30 AM   #15
shijobaby
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Rep: Reputation: Disabled
http://answerforu.com/2011/06/22/acc...ser-mysql-php/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MYSQL: Access denied for user 'root'@'localhost' (using password: NO) jun_tuko Linux - Software 3 03-05-2013 07:37 AM
Access denied for user: 'mythtv@localhost' Red Knuckles Ubuntu 1 10-04-2007 04:12 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) S canegames Debian 11 07-18-2007 01:57 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) mohtasham1983 General 2 04-02-2007 07:36 PM
Sarge mysql-server Access denied for user: root@localhost infinity432 Linux - Software 2 05-19-2005 12:42 AM


All times are GMT -5. The time now is 12:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration