Are you connecting to a database on the localhost? Try using localhost instead of the address.
Also, I always confirm I can connect to the db at the commanline using mysql -u ossecuser --password=ossecpassword - if this doesn't work, ossec will have problems too. If you are connecting to a db on a different host, you have to make sure the mysql server is configured to allow remote connections, which some recent distributions are not. You can use the same test above, with -h hostname/ipaddr in this case. Hope this helps Rob ------Original Message------ From: Kelly Egode To: [email protected] ReplyTo: [email protected] Subject: [ossec-list] Re: Database configuration errors Sent: 25 Jun 2009 11:27 Hello D, Thanks so far for you assistance. I have ran the following as asked successfully: # mysql -u root -p mysql> create database ossec; mysql> grant INSERT,SELECT,UPDATE,CREATE,DELETE,EXECUTE on ossec.* to ossecuser@<ossec ip>; Query OK, 0 rows affected (0.00 sec) mysql> set password for ossecuser@<ossec ip>=PASSWORD('ossecpass'); Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit # wget http://www.ossec.net/files/other/mysql.schema # mysql -u root -p ossec < mysql.schema My challenge is the error: cannot connect to database still persist. <!-- Database Config --> <database_output> <hostname>10.2.5.78</hostname> <username>ossecuser</username> <password>12333</password> <database>ossec</database> <type>mysql</type> </database_output> | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | | 10.2.5.78 | ossecuser | 1a9gr6a73bo75hfjj | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | 2009/06/25 10:59:05 ossec-dbd(5202): ERROR: Error connecting to database '10.2.5.78'(ossecdb): ERROR: Access denied for user 'db_kellyAdmin'@'ossec.gtbank.com' (using password: YES). 2009/06/25 10:59:12 ossec-dbd(5202): ERROR: Error connecting to database '10.2.5.78'(ossecdb): ERROR: Access denied for user 'db_kellyAdmin'@'ossec.gtbank.com' (using password: YES). 2009/06/25 11:01:23 ossec-dbd(5202): ERROR: Error connecting to database '10.2.5.78'(ossecdb): ERROR: Access denied for user 'db_kellyAdmin'@'ossec.gtbank.com' (using password: YES). Kindly assist me with the various steps to resolve. Kelly. ----- Original Message ----- From: "Daniel Cid" <[email protected]> To: <[email protected]> Sent: Wednesday, June 24, 2009 7:39 PM Subject: [ossec-list] Re: Database configuration errors > > Hi Kelly, > > This error is generally caused by permission errors on the database > side. You need to > use the same ip address in the ossec config and on the GRANT command: > > If you added "10.2.5.78" as the db server, make sure to run: > >> grant INSERT,SELECT,UPDATE,CREATE,DELETE,EXECUTE on ossec.* to >> [email protected]; >> set password for [email protected]=password('ossecpass'); > > > It might be easier to just switch to 127.0.0.1 and debug from there... > > Thanks, > > -- > Daniel B. Cid > dcid ( at ) ossec.net > > > On Wed, Jun 24, 2009 at 11:25 AM, Derek J. > Morris<[email protected]> wrote: >> >> In her defense, I followed these exactly and same issue. >> >>> >>> Did you follow the directions? >>> http://www.ossec.net/wiki/index.php/Know_How:DatabaseOutput >>> Make sure you use the right IP/hostname in the following command: >>> grant INSERT,SELECT,UPDATE,CREATE,DELETE,EXECUTE on ossec.* to >>> ossecuser@<ossec ip>; >>> >>> I put 127.0.0.1 instead of localhost and got a similar error. >>> dan >>> >>> On Tue, Jun 23, 2009 at 10:41 AM, Kelly Egode<[email protected]> wrote: >>>> Hello All, >>>> >>>> I am unable to connect my Ossec application to mysql database both are on >>>> thesame server >>>> Kindly review the report below and advice me on what to do: >>>> >>>> 2009/06/09 22:51:52 ossec-logcollector: INFO: Started (pid: 14085). >>>> 2009/06/09 22:51:52 ossec-analysisd(1210): ERROR: Queue '/queue/alerts/ar' >>>> not accessible: 'Connection refused'. >>>> 2009/06/09 22:51:52 ossec-analysisd(1301): ERROR: Unable to connect to >>>> active response queue. >>>> 2009/06/09 22:51:52 ossec-analysisd: INFO: Connected to >>>> '/queue/alerts/execq' (exec queue) >>>> 2009/06/09 22:52:46 ossec-dbd(5202): ERROR: Error connecting to database >>>> '10.2.5.78'(ossecdb): ERROR: Host '10.2.5.78' is not allowed to connect to >>>> this MySQL server. >>>> 2009/06/09 22:53:13 ossec-dbd(5202): ERROR: Error connecting to database >>>> '10.2.5.78'(ossecdb): ERROR: Host '10.2.5.78' is not allowed to connect to >>>> this MySQL server. >>>> 2009/06/09 22:53:20 ossec-dbd(5202): ERROR: Error connecting to database >>>> '10.2.5.78'(ossecdb): ERROR: Host '10.2.5.78' is not allowed to connect to >>>> this MySQL server. >>>> 2009/06/09 22:54:14 ossec-dbd(5202): ERROR: Error connecting to database >>>> '10.2.5.78'(ossecdb): ERROR: Host '10.2.5.78' is not allowed to connect to >>>> this MySQL server. >>>> >>>> Best regards, >>>> Kelly >>> >> >> - Any views expressed in this message are those of the individual sender, except where specifically stated to be the view of the Company, its subsidiaries or associates. When addressed to our customers, any opinions or advice contained in this eMail are subject to the relevant Company terms of business. The Company reserves the right to monitor all email communications through its internal and external networks. NOTICE: This eMail is intended solely for the named recipient only. It may contain privileged and/or confidential information. If you are not one of the intended recipients, please notify the sender immediately, and destroy this eMail; you must not copy, distribute or take any action in reliance upon it. Whilst all efforts are made to safeguard Inbound and Outbound eMails, the Company cannot guarantee that attachments are Virus-free or compatible with your systems and does not accept any liability in respect of viruses or computer problems experienced. IMPORTANT: Credit Card Details should not be sent to the Company by email.
