Avatar of Mike
Mike asked on

mytop on debian won't run

Not finding anything on the net about this problem that can help.
It's installed on Debian 11 and while this shows one try, I've tried many other ways including;

mytop
mytop -u root -p
mytop -u root -d mysql --prompt

I've also tried with and without a .mycnf file in the /root directory.

The so called 'exact' errors never seem to lead to the actual problem.
Since I cannot find much info, I don't know for sure if mytop is looking for this file where I have it or somewhere else. I did not find a .mytop file anywhere else on the system.

# mytop
Cannot connect to MariaDB/MySQL server. Please check the:

  * database you specified "mysql" (default is "")
  * username you specified "root" (default is "root")
  * password you specified "" (default is "")
  * hostname you specified "localhost" (default is "localhost")
  * port you specified "3306" (default is 3306)
  * socket you specified "" (default is "")

The options my be specified on the command-line or in a ~/.mytop or
~/.my.cnf config file. See the manual (perldoc mytop) for details.

Here's the exact error from DBI. It might help you debug:

Connection error: port cannot be specified when host is localhost or embedded

Open in new window

DatabasesMySQL Server* DebianLinux

Avatar of undefined
Last Comment
David Favor

8/22/2022 - Mon
Dr. Klahn

a) Is MariaDB or MySQL installed on the system?  If so, does it pass its own diagnostics?  What is the name of the database you're trying to connect to?

b) Look in the config file.  The startup process thinks a port number is being specified and that the host is "localhost" (i.e., the same system, 127.0.0.1)  There is a clear conflict in what the startup is reporting:

  * hostname you specified "localhost" (default is "localhost")
  * port you specified "3306" (default is 3306)

  resulting in (at least) "Connection error: port cannot be specified when host is localhost or embedded"
David Favor

Just try this...

mytop

Open in new window


No options...

If you have a plain vanilla install of MySQL or MariaDB, then mytop will work using either /etc/mysql/debian.cnf (MySQL) or root auth plugin (MariaDB).

Attempting to pass options... mytop will just ignore them... for most versions of mytop...

Also, there's no such file as .mytop ( whatever that might be) so this will be ignored if it exist.

Note: Refer to the man page for what you can + can't supply to mytop.
Tomas Helgi Johannsson

Hi,

Check out this link on how to configure and connect to a database using mytop.
Your root user  might be missing the .mytop (thus /root/.mytop) config file.

Regards,
    Tomas Helgi

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
Mike

The server is running the latest mariadb service and everything works fine.

As I mentioned, I've tried a number of different things and so far nothing works.
Without a /root/.mytop config file, I get this.

# mytop
Use of uninitialized value $ENV{"HOME"} in concatenation (.) or string at /usr/bin/mytop line 136.
Cannot connect to MariaDB/MySQL server. Please check the:

  * database you specified "" (default is "")
  * username you specified "root" (default is "root")
  * password you specified "" (default is "")
  * hostname you specified "localhost" (default is "localhost")
  * port you specified "3306" (default is 3306)
  * socket you specified "" (default is "")

The options my be specified on the command-line or in a ~/.mytop or
~/.my.cnf config file. See the manual (perldoc mytop) for details.

Here's the exact error from DBI. It might help you debug:

Connection error: port cannot be specified when host is localhost or embedded


Open in new window

No matter if I try entering the options on the command line or in the config file, I get errors. Mostly it complains about the port, other times it complains about other things.

With the config file suggested in the link posted;
host=localhost
db=mysql
delay=5
port=3306
socket=
batchmode=0
color=1
idle=1

Open in new window

I get the exact same port error.
I had tried this exact config and other variations but always some errors.
The /etc/mysql/my.cnf file does not have the port in there. Could it be as simple as that?
ASKER CERTIFIED SOLUTION
Yujin Boby

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
David Favor

The use of a .mytop file seems to only apply to some versions of mytop.

The mytop I'm running (Ubuntu Focal) doesn't document this file as being used + if I create ~/.mytop + camp on it with inotifywait, then the file is opened, so I'd verify your version of mytop actually accesses this file, before investing time setting it up.

In Debian, you should never have any concern about this, as /etc/mysql/debian.cnf is setup by default for MySQL or with MariaDB, installed from the project's repositories (best option) the root authentication plugin runs automatically.

In either case, if mytop fails, that means 2x likely possibilities.

1) Your runtime environment is munged/destroyed. This is best fixed as future package updates + many other housekeeping functions will fail.

2) You're running as a non-root user, so if you create a ~/.mytop file, you've just exposed your root db login to any hacker accessing your machine.

Having cleansed many a machine of hacks, best to avoid this security hole... by fixing #1, if required, then only running mytop as the root user, so if required...

sudo mytop

Open in new window