Error in connecting Mysql Database

Dear All,

I am not able to connect to mysql database. The error message is shown below:

*+"A connection to the database could not be made. View the error message

by opening the “/logs/error.log” log file, then go back to fix the

problem."+*

I have attached the Database Settings- Standard Connection page. I am using CentOS 5 and mysql version is mysql-5.0.22-2.1. Mysql is running and i have created database as openfire.

Please Help

Hi.

I think you must change the database URL to jdbc:mysql://localhost:3306/openfire (remove the ‘’) characters.

BR

Thanks for you reply.

I did as you said but again i am getting same error

Hi,

What does your /logs/error.log says?

you may want to try enabling --old-passwords in the mysql settings of the mysql database server.

reference: http://dev.mysql.com/doc/refman/5.1/en/old-client.html

Change[ [localhost] ] to you IP number and remove and remove from openfire

i have remove a localhost to ip given as

jdbc:mysql://xxx.xxx.xxx.xxx:3306/openfire

but still gives a same error

What does your /logs/error.log says?

It is important that you know the problem statement first. The error.log file would show you the kind of problem you’re facing. Can you see any problem in that file?

here is my error log attached Please view it

in 2nd line error message shows as “Access denied for user ‘admin’@‘domain.com’ (using password: YES)”.

But i can login to mysql from terminal by giving mysql -uadmin -p openfire.

Now that we can narrow down to the problem

You need to INSERT a record in you ‘mysql.db’ table specifying that your openfire admin user (in your case ‘admin’) can connect to ‘openfire’ database from host ‘domain.com’. This will grant the user the necessary access privilege. Remember to reload or restart your mysql after the INSERT.

You may also need to check your ‘mysql.user’ table and do necessary adjustment.

For MYSQL use mysql admin gui login to your MYSQL server goto tools

manage connection.The user name you are using connect fill in the info

and try again

and dont forget to set up your database permissions! and for user name set all permissions for the user name to information_schema and mysql and openfire databases

and here is a grate MYSQL database editor

http://www.heidisql.com/

Aznidin,

Below is my mysql db table. But even i am getting same error.

select * from db where db=‘openfire’;

*----


*–


+–-+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+–


Host

Db

User

Select_priv

Insert_priv

Update_priv

Delete_priv

Create_priv

Drop_priv

Grant_priv

References_priv

Index_priv

Alter_priv

Create_tmp_table_priv

Lock_tables_priv

Create_view_priv

Show_view_priv

Create_routine_priv

Alter_routine_priv

Execute_priv

*----


*–


+–-+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+–


localhost

openfire

admin

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

xxx.xxx.xxx.xxx

openfire

admin

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

If the server running the mysql is a linux server you could also use webmin to make changes to most aspects of the server. http://www.webmin.com

| xxx.xxx.xxx.xxx | openfire | admin | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |

As far as I could tell, error “Access denied for user ‘admin’@‘domain.com’ (using password: YES)” came from the MySQL server. That means you could connect to MySQL server but the server didn’t allow access. So, it’s the problem with MySQL permission setting. Either the password was not correct or MySQL knew nothing about domain.com.

My guess is that either:

  • wrong password

  • wrong spelling/entry of host in Host field (the name that you hide above)

  • you didn’t restart/reload MySQL/grant tables every time you change permissions.

Also, if the error message says exactly as ‘admin’@‘domain.com, then the Host field has to contain the exact domain.com or the correct variation of wildcards including just the % character. FYI, %.domain.com or the IP address of domain.com will not work. xxx.xxx.xxx.xxx will definitely fail.

Like others have suggested, you might want to consider using the friendly tools to administer MySQL server.

Good luck

Thank You to all of you.

I have change in jdbc:mysql://xxx.xxx.xxx.xxx:3306/openfire.

xxxx.xxx.xxx.xxx was ip i have previously used but when i change it to domain name it works.

Once again thank you.

yes use mysql admin gui and heidi sql for edit database first thing to do drop the database you are working on now and start with a new one.the tools I have recommended are simple and make the job much faster