MySQL Administration & Configuration-Unit-2-Part-II
MySQL Administration & Configuration-Unit-2-Part-II
Configuration of MySQL
Course Name:
Database Faculty Name:
Administration Ms. Zaiba Khan
with MySQL
Branch- Assistant Professor(CSE)
B.Tech-VI Semester School of
Course Code: Engineering &
Technology
19009300
1
Basic Server Administration
3
Basic Server Administration
(Shell Prompt)
4
Starting and Stopping the Server
5
Tip: Better Safe Than Sorry
6
Starting and Stopping the Server
7
Starting and Stopping the
Server(Cont..)
We can also verify if the server is running and this can be done by
using mysqladmin tool with ping command
[root@host]# /usr/local/mysql/bin/mysqladmin ping
mysqld is alive
8
Starting and Stopping the Server
9
Starting and Stopping the Server
10
Checking MySQL Server Status
11
Checking MySQL Server Status
An Equivalent approach is to use the VERSION( ) built-
in function
12
Checking MySQL Server Status
Extended status information is also available via the
extended-status command to mysqladmin or with
the SHOW STATUS command
13
Checking MySQL Server Status
A great deal of real time status information is provided:
◦ It contains the amount of traffic the server received since it last
started
Including no. of bytes sent and received
The client connection
Together with a breakdown of how many succeeded
How many failed
How many aborted
◦ It also contains statistics on the total no. of queries processed by
the server since startup, together with information on the no. of
the quires in each type(SELECT,DELETE,INSERT,…….)
◦ The number of threads active
◦ The number of current client connections
◦ The number of running queries
◦ The number of open tables
14
Managing MySQL Client Processes
A complete list of all client processes connected to the
server with the SHOW PROCESSLIST command
15
Managing MySQL Client Processes(Cont..)
A “regular” user will only be able to see his or her own threads in
the output of SHOW PROCESSLIST
The PROCESS privilege can, however , see all running threads
Users with the all powerful SUPER privilege can even kill running
threads, with the KILL command.
mysql> KILL 12;
Query OK, 0 rows affected (0.01 sec)
16
Altering The Server Configuration
The Software comes preconfigured by MySQL to meet most
common needs.
However, in case the default configuration doesn’t work , MySQL
exposes a large number of variables whose values can be modified
to meet custom requirements
NOTE:
A thread doesn’t die immediately on receiving a kill signal
Rather, MySQL sets a kill flag for that particular thread
It is checked by the thread once it completes
This approach is considered safer
WHY
Because it allows the thread to complete whatever it’s doing &
release any locks it created
17
Using An Option File
18
Using An Option File(Continue….
MySQL looks in the groups[mysql] and [mysqld] for configuration
options.
19
Using An Option File(Continue….
Note, all these options can be specified on the MySQL command
line as well , simply by prefixing the option name with a double
dash.
Example:
[root@host]# /usr/local/mysql/bin/mysqld_safe
21
Using The SET Command(Continue….
Variables set using the SET command can be set globally for
all sessions / for the current session
By following example the SET keyword with either the
GLOBAL or SESSION keyword
The following example limits the server to ten client
connections at any time and sets the size of the read buffer to
250 KB:
22
Using The SET Command(Continue….
23
Retrieving Variable Value
MySQL lets you filter it down to just the variable you want
with the addition of LIKE clause
24
Retrieving Variable Value
25
Retrieving Variable Value
26
Summary
27