A quicky, but something I don’t think many people know about. If you’ve ever had a MySQL server that seems slammed, but a SHOW PROCESSLIST shows nothing of note, it’s likely because your server is keeping up with processing the queries and not hanging up on them – which is good because that means your server can keep up with the load, but bad because the query isn’t “hanging out” in a non-completed status and showing in your list.
If you want to “dip a ladle” into the queries for a few moments and see what’s being processed, log into the server with root (or equivalent privileges) and issue the following commands. Please note that these entered use around MySQL 5.1 (check here for more information):
SET GLOBAL general_log_file="C:/QueryLog.txt"; (or /var/log/mysql/query.log, etc)
SET GLOBAL general_log=ON;
[Wait a few seconds, minutes, etc to collect your data]
SET GLOBAL general_log=OFF;
MySQL will happily log the queries entering the server for you as long as you want it to, to give you a chance to see what’s got the thing so busy. If you’re not the only admin on the server, you might want to issue a SHOW VARIABLES command to see if someone else is already doing some logging to avoid stepping on their toes.
Working as a consulting engineer means frequently walking into situations you know nothing about … and equipment you have no access to. Today’s example was walking into a small business telco closet and staring down a phone system and a 48-port switch which the phone vendor needed reconfigured.
Of course, they didn’t know the password…
Here’s how to reset the password on the V1910 and not totally lose the configuration (read through for the caveat) – unfortunately this was an emergency situation and I have no V1910 of my own, so I have no screenshots to accompany.
- Attach a console cable and confirm communication (typically these devices are set to 38400 baud, 8/N/1).
- Power-cycle the device and watch for a boot prompt offering options if you hit CTRL-B. Oblige it.
- Select option #7 to boot without a configuration file. This doesn’t delete the configuration, it just tells the switch to ignore it.
- Reboot the switch as it suggests.
- Once it gets to the command prompt, start the ‘hidden’ command prompt by entering _cmdline-mode on and hitting enter. It’ll ask you if you want to do this, you do. Enter a password of 512900 to gain access.
- Once you are in, be aware that there are two modes – user and system – something like the standard and enabled prompt on a Cisco. You can enter the system configuration by typing sys and hitting enter, but you begin in user mode. Here you can type more flash:/startup.cfg to see the existing configuration. There’s also an XML file on some switches – review this file too! For the curious, you can dir the contents of flash just like a Cisco.
- If you are lucky, the admin user’s password was just revealed to you in plaintext in the configuration file. You could reboot now and try entering it.
- If you are unlucky, you could copy the configuration file off of the switch using the backup and restore commands in conjunction with a TFTP service and delete the local-user admin sections to leave it as default.
- On some switches, I’ve had to use the startup command to tell the switch which startup file to use upon next reboot. I might do this here for safety.
Pretty simple – I have yet to see a how-to guide that doesn’t tell you that an initialize command is required, so I’m hoping this helps someone!