You can get a similar effect using the my_print_defaults program and specifying the command groups you’re interested in. For example, to seethe settings for all clients and for the mysqldump program, you can type
my_print_defaults client mysqldump--socket=/home/mysql/server1.sock
--all-databases
--result_file=/tmp/dump.sql
--host=localhost
--port=3306
--database=Music
--result_file=/home/saied/dump.sql
Exercises1. What issues would you consider before storing your password in an options file.
On a Linux or Mac OS X system, under
what circumstances would the [server]
section of the
/.my.cnf options file be read. How can you tell what options a program uses by default?
Exercises | 377 CHAPTER 12Configuring and Tuning the ServerThe MySQL server has many features that can be configured to best fit the needs of your system hardware and application. The default settings are fine for most applications, but there area few that you should be aware of.
In this chapter, we look at how you can modify server configuration to suit your setup and for improved overall performance.
There are two types of MySQL program settings options, which dictate what a program should do,
and variables, which dictate the amount of resources that should beset aside for different tasks. Options and variables can be server-wide (global) or limited to a single client session. Some variables apply to the server, while others apply to individual processes, or
threads, that handle queries. Resources are generally allocated to a thread only if it requires them. Options and variables can be
specified in an options file, or from the command line when starting a program.
You don’t have to come up with optimal settings for each setting on your server. There are ready-to-use configuration files in the
support-files directory under the MySQL directory. The
my-medium.conf file includes recommended settings for most applications and server configurations other distributed configuration file variants are tailored for
“small,” large and huge installations. You can use one of these files as a starting point for your customizations. On a Linux or Mac OS X system, you can copy the file you want to a standard location so that it will be read by the server on a Windows system, you will have to explicitly tell the server to read in the file. Let’s look at the server options in more detail.
Share with your friends: