启动OpenSIPS时,报下列错误
[root@OpenSIPS ~]# opensipsctl start
INFO: Starting OpenSIPS :
ERROR: PID file /var/run/opensips.pid does not exist -- OpenSIPS start failed
查看日志文件
[root@OpenSIPS ~]# tail /var/log/messages
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:db_mysql:db_mysql_connect: driver error(1045): Access denied for user 'opensips'@'localhost' (using password: YES)
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:db_mysql:db_mysql_new_connection: initial connect failed
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:core:db_do_init: could not add connection to the pool
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:acc:acc_db_init: unable to connect to the database
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:acc:mod_init: failed...did you load a database module?
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:core:init_mod: failed to initialize module acc
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: ERROR:core:main: error while initializing modules
Jun 4 13:34:36 OpenSIPS /sbin/opensips[53232]: INFO:core:cleanup: cleanup
Jun 4 13:34:36 OpenSIPS opensips: INFO:core:daemonize: pre-daemon process exiting with -1
解决方法:
mysql> grant all privileges on opensips.* to opensips@localhost identified by 'opensipsrw';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
重新启动OpenSIPS
[root@OpenSIPS ~]# opensipsctl start
INFO: Starting OpenSIPS :
INFO: started (pid: 53374)
问题解决!