记proxysql管理模式的一个小坑

proxysql中,如果管理用户名,和mysql user中重名,则会导致管理口无法登陆,提示如下:

1
ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin' (using password: YES)

最近将proxysql配置文件进行了修改,然后突然发管理界面登录不上去了,排查了半天后发现:

  1. 由于是容器话部署,所以启动参数中,指定每次都是从配置文件中加载。
1
proxysql -c /etc/proxysql/proxysql.cnf -D /var/lib/proxysql  -f --initial
2. 管理密码使用了默认的admin:admin,而配置文件中新增了admin用户。导致重名。
 3.  将管理用户名改为很不常见的。 问题解决

相关的github issue.

实际上,在proxysql的wiki也是提到了这点的

admin-admin_credentials

This is a list of semi-colon separated user:password pairs, that can be used to authenticate to the admin interface with read-write rights. For read-only credentials that can be used to connect to the admin, see the variable admin-stats_credentials. Note that the admin interface listens on a separate port from the main ProxySQL thread. This port is controlled through the variable admin-mysql_ifaces.

It is important to note that:

  • the default admin user can only connect locally, in order to connect remotely a secondary user needs to be created by defining this in the admin-admin_credentials variable E.G. admin-admin_credentials="admin:admin;radminuser:radminpass".
  • users in admin-admin_credentials cannot be used also in mysql_users table.