NFsec Logo

Logowanie do pliku sesji MySQL

03/08/2012 w Administracja Brak komentarzy.  (artykuł nr 361, ilość słów: 167)

W

jaki sposób zapisać przebieg sesji z interfejsu linii poleceń serwera MySQL do pliku? Wystarczy do tego celu wykorzystać polecenie tee:

mysql> tee /tmp/mysql_session
Logging to file '/tmp/mysql_session'
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables like '%slow%';
+--------------------------+
| Tables_in_mysql (%slow%) |
+--------------------------+
| slow_log                 |
+--------------------------+
1 row in set (0.00 sec)

mysql> quit;
Bye


Wszystkie informacje wyjściowe zostaną zapisane do pliku /tmp/mysql_session:

root@stardust ~]# cat /tmp/mysql_session 
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables like '%slow%';
+--------------------------+
| Tables_in_mysql (%slow%) |
+--------------------------+
| slow_log                 |
+--------------------------+
1 row in set (0.00 sec)

mysql> quit;

W celu zatrzymania zapisu wystarczy wydać polecenie: notee.

Więcej informacji: mysql commands

Kategorie K a t e g o r i e : Administracja

Tagi T a g i : , , ,

Komentowanie tego wpisu jest zablokowane.