author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 22 Dec 2020 11:23:56 +0200 | |
changeset 2480 | 0766b2899607 |
parent 2268 | 37e3d0581794 |
permissions | -rw-r--r-- |
1809 | 1 |
.. -*- coding: utf-8; -*- |
2 |
||
3 |
================ |
|
4 |
MySQL/MariaBD. |
|
5 |
================ |
|
6 |
.. contents:: |
|
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1880
diff
changeset
|
7 |
:local: |
1809 | 8 |
|
2266
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
9 |
SQL clients |
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
10 |
=========== |
1809 | 11 |
|
2228
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
12 |
https://mariadb.com/kb/en/mariadb/clients-and-utilities/ |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
13 |
Clients and Utilities. |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
14 |
https://mariadb.com/kb/en/mariadb/graphical-and-enhanced-clients/ |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
15 |
Graphical and Enhanced Clients. |
1810 | 16 |
|
2266
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
17 |
mysql |
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
18 |
----- |
1809 | 19 |
|
2266
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
20 |
Official client. Install ``mariadb-client`` package. |
1809 | 21 |
|
22 |
Usage:: |
|
23 |
||
24 |
$ mysql -u $USER -p |
|
25 |
Enter password: <== Type password. |
|
26 |
||
2267
2509bce24bb8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2266
diff
changeset
|
27 |
$ mysql -h $HOST -u $USER -p$PASS |
2509bce24bb8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2266
diff
changeset
|
28 |
$ mysql -h $HOST -u $USER -p$PASS $DATABASE |
2509bce24bb8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2266
diff
changeset
|
29 |
|
2266
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
30 |
$ mysql --host=$HOST --user=$USER --password=$PASS |
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
31 |
$ mysql --host=$HOST --user=$USER --password=$PASS $DATABASE |
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
32 |
|
2268
37e3d0581794
Connecting to the MySQL Server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2267
diff
changeset
|
33 |
$ mysql --host=$HOST --port=$PORT --user=$USER --password=$PASS $DATABASE |
37e3d0581794
Connecting to the MySQL Server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2267
diff
changeset
|
34 |
$ mysql --host=$HOST --port=$PORT --protocol=TCP --user=$USER --password=$PASS $DATABASE |
37e3d0581794
Connecting to the MySQL Server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2267
diff
changeset
|
35 |
|
1851
e6ffc5f7200e
To save content of session interaction.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1850
diff
changeset
|
36 |
To save content of session interaction in ``mysql`` use:: |
e6ffc5f7200e
To save content of session interaction.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1850
diff
changeset
|
37 |
|
e6ffc5f7200e
To save content of session interaction.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1850
diff
changeset
|
38 |
mysql> tee out.txt |
e6ffc5f7200e
To save content of session interaction.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1850
diff
changeset
|
39 |
|
2268
37e3d0581794
Connecting to the MySQL Server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2267
diff
changeset
|
40 |
https://dev.mysql.com/doc/refman/8.0/en/connecting.html |
37e3d0581794
Connecting to the MySQL Server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2267
diff
changeset
|
41 |
Connecting to the MySQL Server. |
37e3d0581794
Connecting to the MySQL Server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2267
diff
changeset
|
42 |
|
2266
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
43 |
mycli |
373af6f0e7f8
Connecting with mysql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2260
diff
changeset
|
44 |
----- |
1809 | 45 |
|
46 |
Python command line client with completion. Usage:: |
|
47 |
||
48 |
$ mycli -u $USER |
|
49 |
Password: <== Type password. |
|
50 |
||
1880 | 51 |
List databases, tables, columns, indexes. |
52 |
========================================= |
|
1811
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
53 |
:: |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
54 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
55 |
$ mysql -u $USER -p |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
56 |
Enter password: <== Type password. |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
57 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
58 |
SHOW DATABASES; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
59 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
60 |
USE mysql; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
61 |
MariaDB [mysql]> SHOW TABLES; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
62 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
63 |
MariaDB [mysql]> SHOW COLUMNS FROM user; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
64 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
65 |
MariaDB [mysql]> DESCRIBE user; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
66 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
67 |
MariaDB [mysql]> SHOW STATUS; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
68 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
69 |
MariaDB [mysql]> SHOW CREATE DATABASE mysql; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
70 |
MariaDB [mysql]> SHOW CREATE TABLE user; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
71 |
|
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
72 |
MariaDB [mysql]> SHOW GRANTS; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
73 |
|
1880 | 74 |
List indexes:: |
75 |
||
76 |
SELECT * FROM INFORMATION_SCHEMA.STATISTICS; |
|
77 |
||
78 |
SHOW INDEX FROM tbl; |
|
79 |
||
80 |
SHOW INDEX FROM tbl FROM db; |
|
81 |
||
82 |
SHOW CREATE TABLE tbl; |
|
83 |
||
1877 | 84 |
Table/index sizes. |
85 |
================== |
|
86 |
:: |
|
1876 | 87 |
|
88 |
MariaDB [mysql]> SHOW TABLE STATUS FROM mydb; |
|
89 |
||
1878 | 90 |
:: |
91 |
||
1877 | 92 |
SELECT |
1878 | 93 |
table_schema "Database", |
94 |
ROUND(SUM(data_length+index_length)/1024/1024, 2) "Size, MiB" |
|
95 |
FROM information_schema.TABLES |
|
96 |
GROUP BY table_schema; |
|
97 |
||
98 |
SELECT |
|
1879 | 99 |
table_schema AS `Database`, |
100 |
table_name, |
|
101 |
table_rows, |
|
1878 | 102 |
round(((data_length + index_length) / 1024 / 1024), 2) `Size, MiB` |
1877 | 103 |
FROM information_schema.TABLES |
104 |
ORDER BY (data_length + index_length) DESC; |
|
105 |
||
106 |
SELECT |
|
1878 | 107 |
table_schema as `Database`, |
108 |
table_name AS `Table`, |
|
109 |
round((data_length / 1024 / 1024), 2) `Data, MiB`, |
|
110 |
round((index_length / 1024 / 1024), 2) `Index, MiB`, |
|
111 |
round(((data_length+index_length) / 1024 / 1024), 2) `Total, MiB` |
|
1877 | 112 |
FROM information_schema.TABLES |
113 |
ORDER BY (data_length + index_length) DESC; |
|
114 |
||
1849
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
115 |
System information. |
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
116 |
=================== |
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
117 |
|
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
118 |
Server version, platform, etc:: |
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
119 |
|
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
120 |
[mysql]> SHOW VARIABLES LIKE "%version%"; |
a3b639d803e7
System information.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1836
diff
changeset
|
121 |
|
1850
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
122 |
Debugging queries error. |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
123 |
======================== |
1836 | 124 |
|
125 |
After error or warning run:: |
|
126 |
||
1811
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
127 |
MariaDB [mysql]> SHOW WARNINGS; |
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
128 |
MariaDB [mysql]> SHOW ERRORS; |
1836 | 129 |
MariaDB [mysql]> show engine innodb status; |
1811
072cc8a704ce
List databases, tables, columns.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1810
diff
changeset
|
130 |
|
1854
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
131 |
Debugging quiery performance. |
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
132 |
============================= |
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
133 |
:: |
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
134 |
|
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
135 |
explain select 1; |
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
136 |
|
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
137 |
.. |
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
138 |
|
2228
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
139 |
https://mariadb.com/kb/en/mariadb/explain/ |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
140 |
Syntax and transcription of EXPLAIN. |
1854
9b224b68c1e1
Debugging quiery performance.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1853
diff
changeset
|
141 |
|
1850
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
142 |
Monitor server execution. |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
143 |
========================= |
1852
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
144 |
|
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
145 |
List all current executions:: |
1850
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
146 |
|
1852
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
147 |
MariaDB [mysql]> show processlist; |
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
148 |
|
1875
340162fb09a2
Stop selected process
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1854
diff
changeset
|
149 |
Stop selected process:: |
340162fb09a2
Stop selected process
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1854
diff
changeset
|
150 |
|
340162fb09a2
Stop selected process
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1854
diff
changeset
|
151 |
MariaDB [mysql]> kill 12; |
340162fb09a2
Stop selected process
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1854
diff
changeset
|
152 |
|
1852
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
153 |
Dump execution plan for selected process:: |
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
154 |
|
f572f646694b
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1851
diff
changeset
|
155 |
MariaDB [mysql]> show explain for 1; |
1850
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
156 |
|
1853
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
157 |
.. NOTE:: |
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
158 |
You shoud check for code ``1003``:: |
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
159 |
|
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
160 |
MariaDB [mysql]> show warnings; |
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
161 |
|
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
162 |
to ensure for which query plan shown becase query may finished and new |
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
163 |
started. |
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
164 |
|
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
165 |
See: |
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
166 |
|
2228
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
167 |
* `SHOW EXPLAIN in MariaDB 10.0 vs EXPLAIN FOR CONNECTION in MySQL 5.7 |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
168 |
<http://s.petrunia.net/blog/?p=89>`_ |
1853
c6be6cc87df4
Dump execution plan for selected process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1852
diff
changeset
|
169 |
|
1850
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
170 |
Profiling queries. |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
171 |
================== |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
172 |
|
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
173 |
Enable profiling, execute query and review profiling data:: |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
174 |
|
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
175 |
[mysql]> set profiling=1; |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
176 |
[mysql]> select 1; |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
177 |
[mysql]> show profile; |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
178 |
|
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
179 |
Each profiled query results stored separately. To get list of results:: |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
180 |
|
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
181 |
[mysql]> show profiles; |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
182 |
|
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
183 |
To retrieve selected profiling data:: |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
184 |
|
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
185 |
[mysql]> show profile for query 1; |
84707c692266
Monitor server execution. Profiling queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1849
diff
changeset
|
186 |
|
2260
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
187 |
Configuring in Debian |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
188 |
===================== |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
189 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
190 |
After fresh installation login to DB:: |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
191 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
192 |
$ sudo mysql -u root |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
193 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
194 |
Create database and grant permissions to access from ``localhost``:: |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
195 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
196 |
CREATE DATABASE testdb; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
197 |
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
198 |
GRANT ALL PRIVILEGES ON testdb.* TO 'user'@'localhost'; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
199 |
FLUSH PRIVILEGES; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
200 |
quit |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
201 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
202 |
Replace localhost with arbitrary host name or IP address, or use ``%`` to allow any host:: |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
203 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
204 |
CREATE USER 'user'@'192.168.0.1' IDENTIFIED BY 'password'; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
205 |
GRANT ALL PRIVILEGES ON testdb.* TO 'user'@'192.168.0.1'; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
206 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
207 |
CREATE USER 'user'@'%' IDENTIFIED BY 'password'; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
208 |
GRANT ALL PRIVILEGES ON testdb.* TO 'user'@'%'; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
209 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
210 |
Login with client to new database:: |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
211 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
212 |
mysql -u user -p |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
213 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
214 |
Switch to schema:: |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
215 |
|
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
216 |
USE testdb; |
17837e17130b
Allow connection from any host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2228
diff
changeset
|
217 |