OpenSIPS啓動時報ERROR:db_mysql:db_mysql_connect: driver error(1045)的解決方法

啓動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)
問題解決!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章