Exploring the MySQL Daemon – A Guide
The MySQL Daemon Explained
The MySQL daemon, or mysqld for short, is one of the primary tools within the arsenal of any MySQL DBA – the daemon allows for working with MySQL by invoking scripts inside of MySQL’s /var/lib/mysql*.*.** (*.*.** is your MySQL version) folder – these scripts do look differently depending on what operating system is in use (a Windows example of these files can be seen below), but nonetheless, they were all made to accomplish the same purpose – they can (and should) be run via the CLI to solve database performance, management, capacity, availability, or security issues.
Executable files relevant to MySQL 5.7.36.
↓
↑ Executable files relevant to MySQL 5.7.36.
Here’s how the MySQL daemon looks like when launched by a user (bear in mind that the daemon should be launched only after you’ve successfully navigated to the binary folder in MySQL and not before – there are no executable files pertaining to MySQL elsewhere):
The MySQL daemon on a Windows architecture.
↓
↑ The MySQL daemon on a Windows architecture.
The core reason the MySQL daemon exists is to let us get deeply involved into MySQL’s functionality under the hood – since the daemon can be launched from the bin folder, the bin folder also consists of all of the rest of the files that are relevant for MySQL to function normally including, but not limited to:
- innochecksum which is an offline checksum utility for the InnoDB storage engine.
- myisam_ftdump, myisamchk, myisamlog and other tools relevant to the (now obsolete) MyISAM storage engine within MySQL.
- mysqlbinlog which is an offline utility aimed at making the processing of binary log files as fast and efficient as possible.
- mysqlcheck which is a tool that helps MySQL DBAs perform database maintenance routines.
- Functions like mysqlshow, mysqlslap, perror, replace, resolveip, or zlib_decompress – each of them complete different things and can be used for stress-testing, replacing one string with another, IP resolving, or even get a quick glance on which databases, tables, or columns within them exist within MySQL’s infrastructure.
One of the most prominent database load emulation clients, mysqlslap, can be used like so (see example below for the results):
On the mysqlslap front alone, the list of available options can include:
- A concurrency option that specifies how many queries should run.
- An iterations option that specifies the amount of iterations intended to run by mysqlslap (the recommended number is 10 or above.)
- Options like number-int-cols or number-char-cols that define how many columns related to characters or integer values should MySQL work with.
- Some users might also consider specifying the --auto-generate-sql option to let MySQL automatically generate SQL queries that it will “slap itself” with.
The usage of mysqlslap through mysqld.
↓
↑ The usage of mysqlslap through mysqld.
The same goes for all other CLI-based tools within the infrastructure of MySQL – even the tools relevant to the now-obsolete MySQL’s storage engine, MyISAM (the myisam_ftdump tool was used to gain information on all fulltext indexes centered around the MyISAM storage engine within the database management system):
Myisam_ftdump.
↓
↑ Myisam_ftdump.
For everything daemon related, though, users should also consider running it together with the --help option like so (this option will provide a list of all of the available commands relevant to the daemon itself. The --verbose option will act as sort of a documentation within the CLI itself):
A part of the output of mysqld --help --verbose
↓
↑ A part of the output of mysqld --help --verbose
The verbose output of the MySQL daemon should tell you enough about what it’s capable of doing – for many of us, though, its functionality can get a little overbearing since even the most experienced DBAs elect to use 4-5 tools that they know best, and they dedicate the rest to tools dedicated to professionals.
Accompanying mysqld – DbVisualizer
The verbose output of the MySQL daemon is very good, but for those who need to explore their data in the form of Excel spreadsheets, have powerful visualization options, and offer simple, but powerful SQL editors while at the same securing our data with industry-standard best practices, the daemon will not be enough. Such people such turn to tools like DbVisualizer – DbVisualizer is built by some of the smartest people in the Swedish database space and it’s used by well-known companies such as Netflix, Apple, Uber, Citibank, Siemens and even Visa.
There is a good reason why all of the aforementioned companies elect to use DbVisualizer as their primary SQL client – the tool offers a 30-day evaluation period, it’s loaded with powerful performance and security features, and makes working with your most precious data a breeze: did we mention that it supports all of the most popular database management systems as well as most of the exotic choices like Cassandra, NuoDB, MimerSQL, Elasticsearch and the like?
Here’s how part of the visualization process of your databases look like should you elect to use DbVisualizer as your primary database and SQL client:
Visualizing data with DbVisualizer.
↓
↑ Visualizing data with DbVisualizer.
Impressive, isn’t it? And we’re far from done – as you can already notice, DbVisualizer can also provide very valuable information centered around the indexes on the table, its DDL structure, and other things, so make sure to try it today! We recommend familiarizing yourself with the documentation of DbVisualizer alongside with the functions relevant to the MySQL daemon for the best results.
Summary
In this blog, we’ve walked you through some of the features offered by the MySQL daemon – mysqld for short. The MySQL daemon is one of the primary tools concerning all MySQL database administators across the globe as it’s primary purpose is to launch tools within MySQL to help DBAs solve their most pressing issues. We hope that this blog helped you solve some of your issues and taught you something new – we will see you in the next one, but before then, make sure to explore our blog and grab a free trial of DbVisualizer as well – you don’t want to miss out on all of the goodness, do you?
Frequently Asked Questions
What Is mysqld?
Mysqld stands for MySQL daemon – the MySQL daemon is the principal tool to control our databases via the CLI as well as to execute scripts inside of them.
How Does mysqld Work?
The MySQL daemon works by executing the scripts in our /var/lib/mysql/mysql*.*.** folder (if we’re using Windows, that folder can be found over at the /bin/mysql/mysql*.*.**/bin folder – *.*.** refers to our MySQL version.)
When Do I Need to Use mysqld?
Whenever you feel like executing scripts that exist within MySQL.
mysqld Doesn’t Solve All of My Issues and I’d Like to Explore Different Solutions As Well – Where Can I Do That?
If you find that the tools that can be launched through the daemon aren’t sufficient to solve your specific problems, give SQL clients like DbVisualizer a go – they’re usually more than able to put your databases on the performance, capacity, security, and availability highways no matter what database management system you might find yourself using.