在用户表中插入数据时:
执行过mysql授权:
grant all privileges on opensips.* to opensips@'%' identified by '123456' with grant option;
刷新权限
flush privileges;
之后在对数据库表进行操作时报如下错误
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'opensips'@'localhost' (using password: YES)
解决办法:
使用root账号登陆数据库,查询user表
mysql> select host,user from mysql.user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | opensips |
| % | root |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | opensips |
| localhost | root |
+-----------+---------------+
6 rows in set (0.00 sec)
发现异常opensips用户有2处重复了,使用drop user opensips@localhost;
删除1个,之后就可以了