Cannot connect to MySQL database
Question
I would like to use with Motion
MySql.
Motion works perfectly, but I need to put the records on a Mysql Database outside.
Using the commands in webcam1.conf or motion.conf:
sql_log_image on
sql_log_snapshot on
sql_log_mpeg off
sql_log_timelapse off
sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T','%C')
mysql_db my_db_name
mysql_host host_ip_address
mysql_user my_username
mysql_password my_password
When I run motion, the output is this:
[0] Processing thread 0 - config file motion.conf
[0] Processing config file /usr/local/etc/webcam1.conf
[0] Processing config file /usr/local/etc/webcam2.conf
[0] Thread 1 is from /usr/local/etc/webcam1.conf
[0] Thread 2 is from /usr/local/etc/webcam2.conf
[1] Thread started
[2] Thread started
[0] motion-httpd/3.2.8 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] Not a V4L2 device?
[1] Using VIDEO_PALETTE_YUV420P palette
[1] Using V4L1
[2] Not a V4L2 device?
[2] Using VIDEO_PALETTE_YUV420P palette
[2] Using V4L1
[2] Started stream webcam server in port 8888
[1] Cannot connect to MySQL database my_db_name on host host_ip_address with user my_username
[1] MySQL error was Can't connect to MySQL server on 'host_ip_address' (110)
[1] Thread finishing...
Environment
Motion version: |
3.2.8 |
ffmpeg version: |
0.4.9pre1 |
Libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
Kubuntu 7.10, kernel 2.6.22-14-generic |
--
StefanoAprile - 27 Nov 2007
Answer
It seems that is a problem of timeout :
110: Connection timed out
So verify that connection to your mysql it's ok. FYI Mysql 5.x supports automatic reconnection , so if you have this kind of problem is better that you upgrade your mysql server to 5.x version and recompile motion wth mysql client library for 5.x
--
AngelCarpintero - 02 Dec 2007