9

We had a user (User A) starting the mysql client and it would take several seconds to load, the user felt that this just started out of the blue and hadn't done this before. It was causing a few scripts to time-out and there was a concern that it was an issue with the database itself. Upon investigation it was found that 'User B' could start the mysql client on the same server in a blink of an eye.

Woody2143
  • 409
  • 2
  • 7
  • 1
    I know you found the issue, another thing worth having a look at are DNS resolutions (this was a problem with ssh and the reverse resolution). Adding this as a data point. – WoJ Jul 07 '20 at 08:51

1 Answers1

21

Given the above, we felt that ruled out an issue with the DB itself. We did verify that each user was using the same mysql client and had similar ENV/PATH setups.

After giving it some thought we had 'User A' to start the client in verbose mode, which gave us our answer.

-bash-4.3$  mysql --verbose -u userA -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10410
Server version: 5.0.45 MySQL Community Server (GPL)

Reading history-file /home/userA/.mysql_history <----------------- HERE IS THE ISSUE

So if we take a look at this history file of 'User A', it's a 160M file:

-bash-4.3$ ls -lh ~/.mysql_history
-rw------- 1 userA staff 160M Jul  6 14:48 /home/userA/.mysql_history

Where as 'User B' had a much smaller file:

-bash-4.3 ls -lh ~/.mysql_history
-rw------- 1 userB staff 53K Jul  6 14:42 /home/userB/.mysql_history

This may be a simple thing that others just knew off the bat, but we wanted to document it here as our Google-Fu didn't reveal anyone else dealing with this type of issue.

Woody2143
  • 409
  • 2
  • 7
  • What should the CLEAN up cycle be to avoid the problem from time to time? Eliminate those telephone calls next week. – Wilson Hauck Jul 06 '20 at 17:05
  • 4
    There's a reason many Linux shells have a default "max history file size" setting... – iBug Jul 07 '20 at 06:31
  • 1
    To prevent this from happening again, you can try this: https://unix.stackexchange.com/questions/99055/mysql-history-size-limit (Should be easy to extrapolate to your situation) – Ismael Miguel Jul 07 '20 at 08:29