1MYSQLDISKUSAGE(1) MySQL Utilities MYSQLDISKUSAGE(1)
2
3
4
6 mysqldiskusage - Show Database Disk Usage
7
9 mysqldiskusage [options] db ...
10
12 This utility displays disk space usage for one or more databases. The
13 utility optionally displays disk usage for the binary log, slow query
14 log, error log, general query log, relay log, and InnoDB tablespaces.
15 The default is to only show database disk usage.
16
17 If the command-line lists no databases, the utility shows the disk
18 space usage for all databases.
19
20 Sizes displayed without a unit indicator (such as MB) are in bytes.
21
22 The utility determines the location of the data directory by requesting
23 it from the server. For a local server, the utility obtains size
24 information directly from files in the data directory and InnoDB home
25 directory. In this case, you must have file system access to read those
26 directories. Disk space usage shown includes the sum of all storage
27 engine- specific files such as the .MYI and .MYD files for MyISAM and
28 the tablespace files for InnoDB.
29
30 If the file system read fails, or if the server is not local, the
31 utility cannot determine exact file sizes. It is limited to information
32 that can be obtained from the system tables, which therefore should be
33 considered an estimate. For information read from the server, the
34 account used to connect to the server must have the appropriate
35 permissions to read any objects accessed during the operation.
36
37 If information requested requires file system access but is not
38 available that way, the utility prints a message that the information
39 is not accessible. This occurs, for example, if you request log usage
40 but the server is not local and the log files cannot be examined
41 directly.
42
43 To specify how to display output, use one of the following values with
44 the --format option:
45
46 · grid (default)
47
48 Display output in grid or table format like that of the mysql
49 client command-line tool.
50
51 · csv
52
53 Display output in comma-separated values format.
54
55 · tab
56
57 Display output in tab-separated format.
58
59 · vertical
60
61 Display output in single-column format like that of the \G command
62 for the mysql client command-line tool.
63
64 To turn off the headers for grid, csv, or tab display format, specify
65 the --no-headers option. OPTIONS.PP mysqldiskusage accepts the
66 following command-line options:
67
68 · --help
69
70 Display a help message and exit.
71
72 · --license
73
74 Display license information and exit.
75
76 · --all, -a
77
78 Display all disk usage. This includes usage for databases, logs,
79 and InnoDB tablespaces.
80
81 · --binlog, -b
82
83 Display binary log usage.
84
85 · --empty, -m
86
87 Include empty databases.
88
89 · --format=<format>, -f<format>
90
91 Specify the output display format. Permitted format values are
92 grid, csv, tab, and vertical. The default is grid.
93
94 · --innodb, -i
95
96 Display InnoDB tablespace usage. This includes information about
97 the shared InnoDB tablespace as well as .idb files for InnoDB
98 tables with their own tablespace.
99
100 · --logs, -l
101
102 Display general query log, error log, and slow query log usage.
103
104 · --no-headers, -h
105
106 Do not display column headers. This option applies only for grid,
107 csv, and tab output.
108
109 · --quiet, -q
110
111 Suppress informational messages.
112
113 · --relaylog, -r
114
115 Display relay log usage.
116
117 · --server=<server>
118
119 Connection information for the server.
120
121 To connect to a server, it is necessary to specify connection
122 parameters such as user name, host name, password, and either a
123 port or socket. MySQL Utilities provides a number of ways to
124 provide this information. All of the methods require specifying
125 your choice via a command-line option such as --server, --master,
126 --slave, etc. The methods include the following in order of most
127 secure to least secure.
128
129 · Use login-paths from your .mylogin.cnf file (encrypted, not
130 visible). Example : <login-path>[:<port>][:<socket>]
131
132 · Use a configuration file (unencrypted, not visible) Note:
133 available in release-1.5.0. Example :
134 <configuration-file-path>[:<section>]
135
136 · Specify the data on the command-line (unencrypted, visible).
137 Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
138
139
140 · --ssl-ca
141
142 The path to a file that contains a list of trusted SSL CAs.
143
144 · --ssl-cert
145
146 The name of the SSL certificate file to use for establishing a
147 secure connection.
148
149 · --ssl-cert
150
151 The name of the SSL key file to use for establishing a secure
152 connection.
153
154 · --ssl
155
156 Specifies if the server connection requires use of SSL. If an
157 encrypted connection cannot be established, the connection attempt
158 fails. Default setting is 0 (SSL not required).
159
160 · --verbose, -v
161
162 Specify how much information to display. Use this option multiple
163 times to increase the amount of information. For example, -v =
164 verbose, -vv = more verbose, -vvv = debug.
165
166 · --version
167
168 Display version information and exit.
169
170 For the --format option, the permitted values are not case sensitive.
171 In addition, values may be specified as any unambiguous prefix of a
172 valid value. For example, --format=g specifies the grid format. An
173 error occurs if a prefix matches more than one valid value. NOTES.PP
174 You must provide connection parameters (user, host, password, and so
175 forth) for an account that has the appropriate privileges for all
176 objects accessed during the operation.
177
178 The path to the MySQL client tools should be included in the PATH
179 environment variable in order to use the authentication mechanism with
180 login-paths. This will allow the utility to use the my_print_defaults
181 tools which is required to read the login-path values from the login
182 configuration file (.mylogin.cnf). EXAMPLES.PP To show only the disk
183 space usage for the employees and test databases in grid format (the
184 default), use this command:
185
186 shell> mysqldiskusage --server=root@localhost employees test
187 # Source on localhost: ... connected.
188 # Database totals:
189 +------------+--------------+
190 | db_name | total |
191 +------------+--------------+
192 | employees | 205,979,648 |
193 | test | 4,096 |
194 +------------+--------------+
195 Total database disk usage = 205,983,744 bytes or 196.00 MB
196 #...done.
197
198 To see all disk usage for the server in CSV format, use this command:
199
200 shell> mysqldiskusage --server=root@localhost --format=csv -a -vv
201 # Source on localhost: ... connected.
202 # Database totals:
203 db_name,db_dir_size,data_size,misc_files,total
204 test1,0,0,0,0
205 db3,0,0,0,0
206 db2,0,0,0,0
207 db1,0,0,0,0
208 backup_test,19410,1117,18293,19410
209 employees,242519463,205979648,242519463,448499111
210 mysql,867211,657669,191720,849389
211 t1,9849,1024,8825,9849
212 test,56162,4096,52066,56162
213 util_test_a,19625,2048,17577,19625
214 util_test_b,17347,0,17347,17347
215 util_test_c,19623,2048,17575,19623
216 Total database disk usage = 449,490,516 bytes or 428.00 MB
217 # Log information.
218 # The general_log is turned off on the server.
219 # The slow_query_log is turned off on the server.
220 # binary log information:
221 Current binary log file = ./mysql-bin.000076
222 log_file,size
223 /data/mysql-bin.000076,125
224 /data/mysql-bin.000077,125
225 /data/mysql-bin.000078,556
226 /data/mysql-bin.000079,168398223
227 /data/mysql-bin.index,76
228 Total size of binary logs = 168,399,105 bytes or 160.00 MB
229 # Server is not an active slave - no relay log information.
230 # InnoDB tablespace information:
231 InnoDB_file,size,type,specification
232 /data/ib_logfile0,5242880,log file,
233 /data/ib_logfile1,5242880,log file,
234 /data/ibdata1,220200960,shared tablespace,ibdata1:210M
235 /data/ibdata2,10485760,shared tablespace,ibdata2:10M:autoextend
236 /data/employees/departments.ibd,114688,file tablespace,
237 /data/employees/dept_emp.ibd,30408704,file tablespace,
238 /data/employees/dept_manager.ibd,131072,file tablespace,
239 /data/employees/employees.ibd,23068672,file tablespace,
240 /data/employees/salaries.ibd,146800640,file tablespace,
241 /data/employees/titles.ibd,41943040,file tablespace,
242 Total size of InnoDB files = 494,125,056 bytes or 471.00 MB
243 #...done.
244
245 PERMISSIONS REQUIRED.PP The user must have permissions to read the data
246 directory or use an administrator or super user (sudo) account to
247 obtain access to the data directory.
248
250 Copyright © 2006, 2015, Oracle and/or its affiliates. All rights
251 reserved.
252
253 This documentation is free software; you can redistribute it and/or
254 modify it only under the terms of the GNU General Public License as
255 published by the Free Software Foundation; version 2 of the License.
256
257 This documentation is distributed in the hope that it will be useful,
258 but WITHOUT ANY WARRANTY; without even the implied warranty of
259 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
260 General Public License for more details.
261
262 You should have received a copy of the GNU General Public License along
263 with the program; if not, write to the Free Software Foundation, Inc.,
264 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
265 http://www.gnu.org/licenses/.
266
267
269 For more information, please refer to the MySQL Utilities and Fabric
270 documentation, which is available online at
271 http://dev.mysql.com/doc/index-utils-fabric.html
272
274 Oracle Corporation (http://dev.mysql.com/).
275
276
277
278MySQL 1.5.6 09/15/2015 MYSQLDISKUSAGE(1)