Learning Mysql


Determining the Options in Effect



Download 4.24 Mb.
View original pdf
Page344/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   340   341   342   343   344   345   346   347   ...   366
Learning MySQL
Determining the Options in Effect
It can sometimes be unclear which options are in effect fora given program, particularly if you’ve got several options files with overlapping directives. You can use the print- defaults option to most MySQL programs to seethe options in effect. For example, to seethe active options for mysqldump
, you can type mysqldump --print-defaults
mysqldump would have been started with the following arguments:
--socket=/home/mysql/server1.sock
--all-databases
--result_file=/tmp/dump.sql
--host=localhost
--port=3306
--database=Music
--result_file=/home/saied/dump.sql
376 | Chapter 11:
Using an Options File

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
Exercises
1. 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 12
Configuring and Tuning the Server
The 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.

Download 4.24 Mb.

Share with your friends:
1   ...   340   341   342   343   344   345   346   347   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page