Details
-
Bug
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
None
Description
When no username is provided, mytop currently defaults to root.
On Unix, this differs from the behaviour of the mysql and mariadb clients, which use the current login name by default. In local socket-auth setups, this makes mytop behave differently from other MariaDB client tools and can lead to confusing authentication failures.
For instance, running mytop as a regular user without -u or a configured user entry makes it attempt to connect as root@localhost, while mysql and mariadb would use the invoking login name instead.
As a result, users may see errors such as:
Access denied for user 'root'@'localhost' |
even though the equivalent mysql or mariadb invocation follows the expected local user path.
How to reproduce:
1. Run mytop on a Unix system without specifying -u.
2. Make sure no user value is set in config.
3. Observe that mytop uses root as the default username.
Expected result:
On Unix, mytop should default to the invoking user's login name, matching mysql and mariadb.
Actual result: mytop defaults to root.
Proposed fix: Use a platform specific default username:
1. Windows, keep root
2. Unix, use the invoking login name, for example via getpwuid($<), with environment variable fallbacks if needed
Documentation and user-facing messages should also be updated to reflect the actual default behaviour.
Reference:
Debian bug: #1109404