MySQL Setup Instructions

3,437 views
Skip to first unread message

jor...@eics.ab.ca

unread,
Sep 13, 2013, 3:53:45 PM9/13/13
to pwm-g...@googlegroups.com
Hi There,
I was wondering if anyone had some good instructions on how to integrate PWM with MySQL. I am running into roadblocks when I try and set it up. Thanks for the help!
Jordan

Jason Rivard

unread,
Sep 13, 2013, 3:55:00 PM9/13/13
to pwm-general
What problems are you having?



--
You received this message because you are subscribed to the Google Groups "pwm-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pwm-general...@googlegroups.com.
To post to this group, send email to pwm-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pwm-general/8e0e5d7a-d7e6-41a9-95c2-f16ba2266b37%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

jor...@eics.ab.ca

unread,
Sep 13, 2013, 6:10:42 PM9/13/13
to pwm-g...@googlegroups.com
Hi Jason,
I am receiving "Database server is not available: 5051 ERROR_DB_UNAVAILABLE (get operation failed: null)" error in the health monitor. I know the database exists and the username and password I have specified work as I can connect to the db from my desktop. Thoughts?
Jordan

Laszlo Tornoci

unread,
Sep 15, 2013, 3:34:28 AM9/15/13
to pwm-g...@googlegroups.com, jor...@eics.ab.ca
The PWM package doesn't contain the mysql db connector necessary for java programs to connect to the mysql server. You have to provide it.

That's what I did:
1. set up your machine to be able to compile java and use 'ant'
2. download the pwm source
3. install mysql-connector-java
4. copy the mysql-connector jar file to pwm_v1.7.0/servlet/web/WEB-INF/lib
5. cd to pwm_v1.7.0/servlet
6. ant clean
7. ant makeWAR
then save your pwm config, stop your tomcat, delete your old pwm.war and pwm/ dir in webapps,
put in the new pwm.war (found in the build dir), and restart tomcat

You may get away by simply copying to mysql-connector jar file directly into webapps/pwm/WEB-INF/lib and restart tomcat, but I'm not sure that works or if it is the right thing to do. But it never hurts to learn to compile your own pwm.war anyway.

In my experience, pwm loses its connection to mysqld after a few hours, if you use default settings, so I suggest this db connection string in the pwm config:
jdbc:mysql://localhost:3306/pwm_db?sessionVariables=wait_timeout=86400
(db class is: com.mysql.jdbc.Driver)
That is better than increasing the default session timeout in mysqld, because in mysql you cannot increase it per client in the config.

Yours: Laszlo

Jason Rivard

unread,
Sep 15, 2013, 10:34:14 AM9/15/13
to pwm-general
It's not necessary to recompile/build the PWM source.  Simply copying the JDBC driver jar into the WEB-INF/lib directory is all that is required.


jor...@eics.ab.ca

unread,
Sep 16, 2013, 12:12:09 PM9/16/13
to pwm-g...@googlegroups.com
Thank you both. I have placed the mysql-connector-java-5.0.8-bin.jar that I downloaded into the /var/lib/tomcat7/webapps/pwm/WEB-INF/lib folder and restarted Tomcat a few times. I have also modified my connection string as suggested. Unfortunately I am still getting the "Database server is not available: 5051 ERROR_DB_UNAVAILABLE" error. Any other thoughts?

Jordan

Laszlo Tornoci

unread,
Sep 16, 2013, 1:28:01 PM9/16/13
to pwm-g...@googlegroups.com, jor...@eics.ab.ca
You should look at the catalina.out in the tomcat logs. Probably something trivial. From the error it looks like pwm doesn't even see the DB. Perhaps something wrong with the mysql-connector jar file. You should also double check the connection string and make sure the db name is correct.

Laszlo

jor...@eics.ab.ca

unread,
Sep 16, 2013, 4:41:22 PM9/16/13
to pwm-g...@googlegroups.com, jor...@eics.ab.ca
Hi Laszo,
I think I figured it out. I copied the GRANT statement from a previous thread. That statement, "grant all on pwm to 'pwm'@'%' identified by '**PASSWORD**';" had just pwm not pwm.* . So I had access to the database but none of the tables, if that is possible.

So I reran the GRANT statement as "grant all on pwm.* to 'pwm'@'%' identified by '**PASSWORD**';" and all seems to work. Thank you very much for your help!
Jordan

bika...@gmail.com

unread,
Feb 27, 2014, 7:48:48 AM2/27/14
to pwm-g...@googlegroups.com, jor...@eics.ab.ca

Hi,

I am trying to setup PWM 1.7 with Mysql 5.1 , however i did not succeed ,

Database server is not available: 5051 ERROR_DB_UNAVAILABLE (get operation failed: com.mysql.jdbc.Driver)

I tried all the options in this post,

Could you please help

Thanks,
Bikash

Menno Pieters

unread,
Feb 27, 2014, 7:57:22 AM2/27/14
to pwm-g...@googlegroups.com
Instructions:
* Download the JDBC driver for your version of MySQL;
* Make sure MySQL listens on a TCP port (3306 by default, may be disabled on out of the box installations);
* Unzip the driver zip file, put the .jar file in either tomcat's lib folder or PWM's WEB-INF/lib folder;
* Restart PWM;
* Create a database for PWM and set grants to allow an account for PWM to create tables, insert/delete/select from the tables
* Set the correct JDBC URL, username and password in PWM
* Save configuration -> PWM restarts and should be able to create tables now.


--
You received this message because you are subscribed to the Google Groups "pwm-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pwm-general...@googlegroups.com.
To post to this group, send email to pwm-g...@googlegroups.com.

bika...@gmail.com

unread,
Feb 28, 2014, 1:42:19 AM2/28/14
to pwm-g...@googlegroups.com
Thanks Menno,

Mysql connection is working now

Can you please guide me on this problem , how to resolve it

An error occurred during the save of your response questions. Please contact your administrator. { 5045 ERROR_WRITING_RESPONSES (response storage only partially successful; attempts=1, successes=0) }

Thanks,
--Bikash

Menno Pieters

unread,
Feb 28, 2014, 2:24:48 AM2/28/14
to pwm-g...@googlegroups.com
Check the storage and read locations for your repsonses. They can be set to any order and combination of LocalDB, LDAP and Database. In your situation, you may want tot select Database only.


bika...@gmail.com

unread,
Mar 3, 2014, 1:54:03 AM3/3/14
to pwm-g...@googlegroups.com
Thanks Menno,

I made PWM working , i am getting the token on email and able to change password.

I tried for SMS too , however not able to succeed , also i am also not getting any logs on catalina.out regarding sms failures , could you please guide me.

Thanks,
Reply all
Reply to author
Forward
0 new messages