/l3/users/2014-11-nt-voip/nt-voip/root :1 :2 :3 :4 :5 :6 :7 :8 :9 :10 :11 :12 :13 :14 :15 :16 |
|
#apt-cache search asterisk mysql
asterisk-mysql - MySQL database protocol support for the Asterisk PBX |
## коннектор asterisk для mysql
|
## к примеру mysql
|
## давайте делать прараллельно
|
## ставим mysql-server
|
#apt-get install mysql-server
141128 7:46:09 [Note] Plugin 'FEDERATED' is disabled. 141128 7:46:09 InnoDB: The InnoDB memory heap is disabled 141128 7:46:09 InnoDB: Mutexes and rw_locks use GCC atomic builtins 141128 7:46:09 InnoDB: Compressed tables use zlib 1.2.7 141128 7:46:09 InnoDB: Using Linux native AIO 141128 7:46:09 InnoDB: Initializing buffer pool, size = 128.0M 141128 7:46:09 InnoDB: Completed initialization of buffer pool 141128 7:46:09 InnoDB: highest supported file format is Barracuda. 141128 7:46:09 InnoDB: Waiting for the background threads to start 141128 7:46:10 InnoDB: 5.5.38 started; log sequence number 1595675 141128 7:46:10 InnoDB: Starting shutdown... 141128 7:46:11 InnoDB: Shutdown completed; log sequence number 1595675 Starting MySQL database server: mysqld .. Checking for tables which need an upgrade, are corrupt or were not closed cleanly.. Setting up libhtml-template-perl (2.91-1) ... Setting up mysql-server (5.5.38-0+wheezy1) ... |
#apt-get install mysql-client
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: mysql-client 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 76.7 kB of archives. After this operation, 124 kB of additional disk space will be used. Get:1 http://127.0.0.1/debian/ wheezy/main mysql-client all 5.5.38-0+wheezy1 [76.7 kB] Fetched 76.7 kB in 0s (560 kB/s) Selecting previously unselected package mysql-client. (Reading database ... 145972 files and directories currently installed.) Unpacking mysql-client (from .../mysql-client_5.5.38-0+wheezy1_all.deb) ... Setting up mysql-client (5.5.38-0+wheezy1) ... |
#apt-get install asterisk-mysql
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: asterisk-mysql 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 658 kB of archives. After this operation, 783 kB of additional disk space will be used. Get:1 http://127.0.0.1/debian/ wheezy/main asterisk-mysql amd64 1:1.8.13.1~dfsg1-3+deb7u3 [658 kB] Fetched 658 kB in 0s (17.0 MB/s) Selecting previously unselected package asterisk-mysql. (Reading database ... 145977 files and directories currently installed.) Unpacking asterisk-mysql (from .../asterisk-mysql_1%3a1.8.13.1~dfsg1-3+deb7u3_amd64.deb) ... Setting up asterisk-mysql (1:1.8.13.1~dfsg1-3+deb7u3) ... |
#ls -l /tmp/1.sql
-rw-r--r-- 1 user user 910 Nov 28 07:54 /tmp/1.sql |
#cat /tmp/1.sql
create database asterisk; use asterisk; CREATE TABLE cdr ( calldate datetime NOT NULL default ‘0000-00-00 00:00:00′, clid varchar(80) NOT NULL default ”, src varchar(80) NOT NULL default ”, dst varchar(80) NOT NULL default ”, dcontext varchar(80) NOT NULL default ”, channel varchar(80) NOT NULL default ”, dstchannel varchar(80) NOT NULL default ”, ... billsec int(11) NOT NULL default ‘0′, disposition varchar(45) NOT NULL default ”, amaflags int(11) NOT NULL default ‘0′, accountcode varchar(20) NOT NULL default ”, userfield varchar(255) NOT NULL default ”, uniqueid varchar(32) NOT NULL default ” ); ALTER TABLE cdr ADD INDEX ( calldate ); ALTER TABLE cdr ADD INDEX ( dst ); ALTER TABLE cdr ADD INDEX ( uniqueid ); |
#mysql -u root -p <
l3script: syntax error near unexpected token `newline' |
#mysql -u root -p < /tmp/1.sql
Enter password: ERROR 1064 (42000) at line 6: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘0000-00-00 00:00:00′, clid varchar(80) NOT NULL default ”, src varcha' at line 2 |
#vim /tmp/1.sql
--- /tmp/l3-saved-1067.5483.18534 2014-11-28 07:55:20.866968632 -0500 +++ /tmp/1.sql 2014-11-28 07:56:42.998971114 -0500 @@ -4,22 +4,22 @@ use asterisk; CREATE TABLE cdr ( - calldate datetime NOT NULL default ‘0000-00-00 00:00:00′, - clid varchar(80) NOT NULL default ”, - src varchar(80) NOT NULL default ”, - dst varchar(80) NOT NULL default ”, - dcontext varchar(80) NOT NULL default ”, - channel varchar(80) NOT NULL default ”, - dstchannel varchar(80) NOT NULL default ”, - lastapp varchar(80) NOT NULL default ”, - lastdata varchar(80) NOT NULL default ”, - duration int(11) NOT NULL default ‘0′, - billsec int(11) NOT NULL default ‘0′, - disposition varchar(45) NOT NULL default ”, - amaflags int(11) NOT NULL default ‘0′, - accountcode varchar(20) NOT NULL default ”, - userfield varchar(255) NOT NULL default ”, - uniqueid varchar(32) NOT NULL default ” + calldate datetime NOT NULL default '0000-00-00 00:00:00', + clid varchar(80) NOT NULL default '', + src varchar(80) NOT NULL default '', + dst varchar(80) NOT NULL default '', + dcontext varchar(80) NOT NULL default '', + channel varchar(80) NOT NULL default '', + dstchannel varchar(80) NOT NULL default '', + lastapp varchar(80) NOT NULL default '', + lastdata varchar(80) NOT NULL default '', + duration int(11) NOT NULL default '0', + billsec int(11) NOT NULL default '0', + disposition varchar(45) NOT NULL default '', + amaflags int(11) NOT NULL default '0', + accountcode varchar(20) NOT NULL default '', + userfield varchar(255) NOT NULL default '', + uniqueid varchar(32) NOT NULL default '' ); ALTER TABLE cdr ADD INDEX ( calldate ); |
#mysql -u root -p < /tmp/1.sql
Enter password: ERROR 1007 (HY000) at line 2: Can't create database 'asterisk'; database exists |
#mysql -u root -p < /tmp/1.sql
Enter password: |
#cpall /tmp/1.sql /tmp/
1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 1.sql 100% 905 0.9KB/s 00:00 |
#cpall /tmp/1.sql /tmp/
1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 1.sql 100% 915 0.9KB/s 00:00 |
#cat /tmp/1.sql
drop database if exists asterisk; create database asterisk; use asterisk; CREATE TABLE cdr ( calldate datetime NOT NULL default '0000-00-00 00:00:00', clid varchar(80) NOT NULL default '', src varchar(80) NOT NULL default '', dst varchar(80) NOT NULL default '', dcontext varchar(80) NOT NULL default '', channel varchar(80) NOT NULL default '', ... billsec int(11) NOT NULL default '0', disposition varchar(45) NOT NULL default '', amaflags int(11) NOT NULL default '0', accountcode varchar(20) NOT NULL default '', userfield varchar(255) NOT NULL default '', uniqueid varchar(32) NOT NULL default '' ); ALTER TABLE cdr ADD INDEX ( calldate ); ALTER TABLE cdr ADD INDEX ( dst ); ALTER TABLE cdr ADD INDEX ( uniqueid ); |
#mysql -u root -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 48 Server version: 5.5.38-0+wheezy1 (Debian) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ... You can turn off this feature to get a quicker startup with -A Database changed mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP -> on asterisk.* -> to 'asterisk'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password'); Query OK, 0 rows affected (0.00 sec) mysql> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password'); mysql> Bye |
#mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'@'localhost' (using password: NO) |
#mysql -u asterisk -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 50 Server version: 5.5.38-0+wheezy1 (Debian) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> Bye |
#ls -l /etc/asterisk/cdr_mysql.conf
-rw-r----- 1 asterisk asterisk 2231 Jan 3 2014 /etc/asterisk/cdr_mysql.conf |
## вот здесь вы указываете астериску куда ему коннектится
|
#vim /etc/asterisk/cdr_mysql.conf
--- /tmp/l3-saved-1067.6275.19065 2014-11-28 08:06:20.790988572 -0500 +++ /etc/asterisk/cdr_mysql.conf 2014-11-28 08:07:10.878990086 -0500 @@ -12,12 +12,14 @@ ; ;[global] ;hostname=database.host.name -;dbname=asteriskcdrdb -;table=cdr -;password=password -;user=asteriskcdruser +dbname=asterisk +table=cdr +password=password +user=asterisk ;port=3306 -;sock=/tmp/mysql.sock + +; здесь нужен другой файл +sock=/tmp/mysql.sock ;timezone=UTC ; Previously called usegmtime ; ; If your system's locale differs from mysql database character set, |
#netstat -lnp | grep mysql
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 7490/mysqld unix 2 [ ACC ] STREAM LISTENING 347268 7490/mysqld /var/run/mysqld/mysqld.sock |
##
|
#вÐâ# ÑÑÐ¾Ñ /var/run/mysqld/mysqld.sock
|
#TZ=EET date
Fri Nov 28 15:08:41 EET 2014 |
## правильно
|
#vim /etc/asterisk/cdr.conf
--- /tmp/l3-saved-1067.14898.13939 2014-11-28 08:09:08.694993642 -0500 +++ /etc/asterisk/cdr.conf 2014-11-28 08:09:23.754994099 -0500 @@ -11,7 +11,9 @@ ; Define whether or not to use CDR logging. Setting this to "no" will override ; any loading of backend CDR modules. Default is "yes". -;enable=yes + +; включить CDR на всякий случай +enable=yes ; Define whether or not to log unanswered calls. Setting this to "yes" will ; report every attempt to ring a phone in dialing attempts, when it was not |
## всё
|
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk. Starting Asterisk PBX: asterisk. |
## воÑmysql -u asterisk -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 52 Server version: 5.5.38-0+wheezy1 (Debian) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use asterisk 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> select * from cdr; Empty set (0.00 sec) mysql> Bye |
#mysql -u asterisk -ppassword asterisk -c 'select * from cdr;'
mysql Ver 14.14 Distrib 5.5.38, for debian-linux-gnu (x86_64) using readline 6.2 Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Usage: mysql [OPTIONS] [database] -?, --help Display this help and exit. -I, --help Synonym for -? --auto-rehash Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup ... i-am-a-dummy FALSE connect-timeout 0 max-allowed-packet 16777216 net-buffer-length 16384 select-limit 1000 max-join-size 1000000 secure-auth FALSE show-warnings FALSE plugin-dir (No default value) default-auth (No default value) |
#man mysql
|
## на машине 8 всё правильно сделано
|
## на машинах 2,3,4,5,6 неправильно установлен пароль
|
#â# на маÑинаÑ
2 3 6 по пÑÐµÐ¶Ð½ÐµÐ¼Ñ Ð¾Ñибки
|
#all "echo 'select * from cdr;' | mysql -u asterisk -ppassword asterisk "
2: ERROR 1049 (42000): Unknown database 'asterisk' 3: ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES) 4: calldate clid src dst dcontext channel dstchannel lastapp lastdata duration billsec disposition amaflags accountcode userfield uniqueid 4: 2014-11-28 15:33:31 2101 2101 3101 gr1 SIP/2101-00000001 SIP/london-00000002 Dial SIP/london/3101 6 2 ANSWERED 3 1417181611.1 7: calldate clid src dst dcontext channel dstchannel lastapp lastdata duration billsec disposition amaflags accountcode userfield uniqueid 7: 2014-11-28 15:22:39 3101 3101 s menu SIP/3101-00000000 BackGround /var/tmp/asterisk/record1 6 6 ANSWERED 3 1417180959.0 7: 2014-11-28 15:33:36 "2101" <2101> 2101 3101 gr4 SIP/london-00000001 SIP/3101-00000002 Dial SIP/3101,30,tTkK 6 2 ANSWERED 3 1417181616.1 8: calldate clid src dst dcontext channel dstchannel lastapp lastdata duration billsec disposition amaflags accountcode userfield uniqueid 8: 2014-11-28 15:13:13 3201 3201 2 submenu SIP/3201-00000000 BackGround /var/lib/asterisk/sounds/tts/tts-7726ca6e8145e83a1ac38cadb9e05613 14 14 ANSWERED 3 1417180393.0 8: 2014-11-28 15:14:10 3201 3201 5002 gr1 SIP/3201-00000001 SIP/ny-00000002 Dial SIP/ny/5002 12 3 ANSWERED 3 1417180450.1 8: 2014-11-28 15:17:24 3201 3201 3202 gr1 SIP/3201-00000003 SIP/3202-00000004 Dial SIP/3202,20,tTkK 17 8 ANSWERED 3 1417180644.3 8: 2014-11-28 15:33:36 "2101" <2101> 2101 3101 gr4 SIP/ny-00000005 SIP/liverpool-00000006 Dial SIP/liverpool/3101 6 2 ANSWERED 3 1417181616.5 |
#_ last
настройка карточки PRI 1:OK 2:OK 3:OK 4:OK 5:OK 6:OK 7:OK 8:OK |
#_ подклÑÑениÐе к mysql
|
#_ +7 +8
+7 +8 |
#_ подклюlast | ff
l3script: ff: command not found |
#ff() { grep ^"[$(_ last | tr ' ' '\n' | grep :- | cut -c1-2 |tr -d '\n:' ; echo)]": ; }
|
#_ last | ff
|
#_ +4 +5
+4 +5 |
#all "echo 'select * from cdr;' | mysql -u asterisk -ppassword asterisk " | ff
3: ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES) |
#vim /etc/asterisk/cdr_mysql.conf
|
#;compat=no
2: [global] 2: 2: hostname=localhost 2: dbname=asterisk 2: table=cdr 2: password=password 2: user=asterisk 2: port=3306 6: [global] 6: hostname=localhost 6: dbname=asterisk 6: table=cdr 6: password=password 6: user=asterisk 6: port=3306 6: sock=/var/run/mysqld/mysql.sock |
#ssh m1
l3-agent is already running: pid=3555; pidfile=/root/.lilalo/l3-agent.pid |
#less /var/log/asterisk/messages
|
#less /var/log/asterisk/messages
|
#[Nov 28 15:40:42] NOTICE[10611] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI list
; ; Note - if the database server is hosted on the same machine as the ; asterisk server, you can achieve a local Unix socket connection by ; setting hostname=localhost ; ; port and sock are both optional parameters. If hostname is specified ; and is not "localhost" (you can use address 127.0.0.1 instead), then ; cdr_mysql will attempt to connect to the port specified or use the ; default port. If hostname is not specified or if hostname is ; "localhost", then cdr_mysql will attempt to connect to the socket file ... ;alias dstchannel => <a_field_not_named_dstchannel> ;alias lastapp => <a_field_not_named_lastapp> ;alias lastdata => <a_field_not_named_lastdata> ;alias duration => <a_field_not_named_duration> ;alias billsec => <a_field_not_named_billsec> ;alias disposition => <a_field_not_named_disposition> ;alias amaflags => <a_field_not_named_amaflags> ;alias accountcode => <a_field_not_named_accountcode> ;alias userfield => <a_field_not_named_userfield> ;alias uniqueid => <a_field_not_named_uniqueid> |
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk. Starting Asterisk PBX: asterisk. |
#vim /etc/asterisk/cdr_mysql.conf
|
#[global]
; is "yes". ;safeshutdown=yes ; ; ; CHOOSING A CDR "BACKEND" (what kind of output to generate) ; ; To choose a backend, you have to make sure either the right category is ; defined in this file, or that the appropriate config file exists, and has the ; proper definitions in it. If there are any problems, usually, the entry will ; silently ignored, and you get no output. ... ; find this information horribly useless. Others find it very valuable. Note, in "yes" ; mode, you will see one CDR, with one of the call targets on one side, and the originating ; channel on the other, and then one CDR for each channel attempted. This may seem ; redundant, but cannot be helped. ; ; In brief, this option controls the reporting of unanswered calls which only have an A ; party. Calls which get offered to an outgoing line, but are unanswered, are still ; logged, and that is the intended behaviour. (It also results in some B side CDRs being ; output, as they have the B side channel as their source channel, and no destination ; channel.) |
#;unanswered = no
|
#exit
exit Connection to m1 closed. |
#all "echo 'select * from cdr;' | mysql -u asterisk -ppassword asterisk " | ff
1: calldate clid src dst dcontext channel dstchannel lastapp lastdata duration billsec disposition amaflags accountcode userfield uniqueid 1: 2014-11-28 15:41:18 1101 1101 1301 gr1 SIP/1101-00000000 SIP/minsk-00000001 Dial SIP/minsk/1301 6 3 ANSWERED 3 1417182078.0 1: 2014-11-28 15:42:11 "1201" <1201> 1201 1102 gr4 SIP/komsomolsk-00000000 SIP/1102-00000001 Dial SIP/1102,10,tTkK 4 0 NO ANSWER 3 1417182131.0 1: 2014-11-28 15:42:33 "1201" <1201> 1201 1101 gr4 SIP/komsomolsk-00000002 SIP/1101-00000003 Dial SIP/1101,10,tTkK 4 2 ANSWERED 3 1417182153.2 3: ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES) |
#_ +1
+1 |
#less /var/log/asterisk/messages
|
#; executing. By enabling this option, the CDR will be ended before executing
|
#asterisk -rvvv
Asterisk 1.8.13.1~dfsg1-3+deb7u3, Copyright (C) 1999 - 2012 Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= == Parsing '/etc/asterisk/asterisk.conf': == Found == Parsing '/etc/asterisk/extconfig.conf': == Found Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian2 (pid = 11300) ... == Using SIP RTP CoS mark 5 -- Called SIP/kiev/1101 -- SIP/kiev-00000005 is ringing -- SIP/kiev-00000005 answered SIP/1201-00000004 -- Locally bridging SIP/1201-00000004 and SIP/kiev-00000005 == Spawn extension (gr1, 1101, 1) exited non-zero on 'SIP/1201-00000004' -- [dongle0] Trying to connect on /dev/ttyUSB2... [Nov 28 15:45:30] WARNING[11346]: chan_dongle.c:215 opentty: unable to open /dev/ttyUSB2: No such file or directory debian2*CLI> quit Executing last minute cleanups |
#exit
exit Connection to m2 closed. |
#all "echo 'select * from cdr;' | mysql -u asterisk -ppassword asterisk " | ff
3: ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES) |
#less /var/log/asterisk/messages
|
#exit
exit Connection to m2 closed. |
#dpkg-reconfigure mysqld-server
dpkg-query: package 'mysqld-server' is not installed and no information is available Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents. /usr/sbin/dpkg-reconfigure: mysqld-server is not installed |
#ssh m3
Linux debian3 3.2.0-4-amd64 #1 SMP Debian 3.2.63-2+deb7u1 x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Nov 27 11:19:46 2014 from 192.168.12.254 |
#dpkg-reconfigure mysql-server
|
#mysql -u root -p
Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) |
#which mysqld
/usr/sbin/mysqld |
#dpkg -S `which mysqld`
mysql-server-core-5.5: /usr/sbin/mysqld |
#dpkg-reconfigure mysql-server-core-5.5
|
#dpkg -P mysql-server
(Reading database ... 144777 files and directories currently installed.) Removing mysql-server ... |
#apt-get install mysql-server
Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libgadu3 Use 'apt-get autoremove' to remove it. The following NEW packages will be installed: mysql-server 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded. Need to get 0 B/73.9 kB of archives. After this operation, 121 kB of additional disk space will be used. Selecting previously unselected package mysql-server. (Reading database ... 144772 files and directories currently installed.) Unpacking mysql-server (from .../mysql-server_5.5.40-0+wheezy1_all.deb) ... Setting up mysql-server (5.5.40-0+wheezy1) ... |
#ls /var/lib/mysql/
debian-5.5.flag ib_logfile0 mysql/ performance_schema/ ibdata1 ib_logfile1 mysql_upgrade_info |
#ls /var/lib/mysql/
debian-5.5.flag ib_logfile0 mysql/ performance_schema/ ibdata1 ib_logfile1 mysql_upgrade_info |
#/etc/init.d/mysql stop
Stopping MySQL database server: mysqld. |
#mysqld_safe --init-file /tmp/1
sed: -e expression #1, char 10: unknown option to `s' 141128 15:51:03 mysqld_safe Logging to syslog. 141128 15:51:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 141128 15:51:03 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended |
#/etc/init.d/mysql restart
Stopping MySQL database server: mysqld. df: `/var/lib/mysql/.': No such file or directory df: no file systems processed /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full! ... failed! |
#dpkg -P mysql-server
(Reading database ... 144777 files and directories currently installed.) Removing mysql-server ... |
#rm -rf /var/lib/mysql
|
#find /var -name \*mysql\*
/var/cache/apt/archives/mysql-client-5.5_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/mysql-server_5.5.40-0+wheezy1_all.deb /var/cache/apt/archives/mysql-common_5.5.40-0+wheezy1_all.deb /var/cache/apt/archives/mysql-server-5.5_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/mysql-server-core-5.5_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/libmysqlclient18_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/mysql-client_5.5.40-0+wheezy1_all.deb /var/cache/apt/archives/libdbd-mysql-perl_4.021-1+b1_amd64.deb /var/lib/dpkg/info/mysql-server-core-5.5.list /var/lib/dpkg/info/mysql-client.list ... /var/lib/dpkg/info/libmysqlclient18:amd64.postinst /var/lib/dpkg/info/mysql-server-5.5.postrm /var/lib/dpkg/info/mysql-server-5.5.list /var/lib/dpkg/info/mysql-server-5.5.postinst /var/lib/dpkg/info/mysql-client.md5sums /var/lib/dpkg/info/libmysqlclient18:amd64.postrm /var/lib/dpkg/info/libmysqlclient18:amd64.md5sums /var/log/mysql.err /var/log/mysql /var/log/mysql.log |
#find /var -name \*mysql\* | grep -v /dpkg/
/var/cache/apt/archives/mysql-client-5.5_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/mysql-server_5.5.40-0+wheezy1_all.deb /var/cache/apt/archives/mysql-common_5.5.40-0+wheezy1_all.deb /var/cache/apt/archives/mysql-server-5.5_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/mysql-server-core-5.5_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/libmysqlclient18_5.5.40-0+wheezy1_amd64.deb /var/cache/apt/archives/mysql-client_5.5.40-0+wheezy1_all.deb /var/cache/apt/archives/libdbd-mysql-perl_4.021-1+b1_amd64.deb /var/log/mysql.err /var/log/mysql /var/log/mysql.log |
#rm -rf /etc/mysql/
conf.d/ debian.cnf debian-start my.cnf |
#rm /etc/mysql/debian.cnf
|
#apt-get install mysql-server
Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libgadu3 Use 'apt-get autoremove' to remove it. The following NEW packages will be installed: mysql-server 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded. Need to get 0 B/73.9 kB of archives. After this operation, 121 kB of additional disk space will be used. Selecting previously unselected package mysql-server. (Reading database ... 144772 files and directories currently installed.) Unpacking mysql-server (from .../mysql-server_5.5.40-0+wheezy1_all.deb) ... Setting up mysql-server (5.5.40-0+wheezy1) ... |
#/etc/init.d/mysql restart
Stopping MySQL database server: mysqld. df: `/var/lib/mysql/.': No such file or directory df: no file systems processed /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full! ... failed! |
#dpkg -P mysql-server-core-5.5
dpkg: dependency problems prevent removal of mysql-server-core-5.5: mysql-server-5.5 depends on mysql-server-core-5.5 (>= 5.5.40-0+wheezy1). dpkg: error processing mysql-server-core-5.5 (--purge): dependency problems - not removing Errors were encountered while processing: mysql-server-core-5.5 |
#dpkg -P mysql-server-core-5.5 mysql-server-5.5 mysql-server
(Reading database ... 144777 files and directories currently installed.) Removing mysql-server ... Removing mysql-server-5.5 ... Stopping MySQL database server: mysqld. Purging configuration files for mysql-server-5.5 ... Removing mysql-server-core-5.5 ... Processing triggers for man-db ... |
#ls -l /etc/mysql/
conf.d/ my.cnf |
#rm /etc/mysql/my.cnf
|
#apt-get install mysql-server
/etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz ... (warning). Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed! invoke-rc.d: initscript mysql, action "start" failed. dpkg: error processing mysql-server-5.5 (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-server-5.5; however: Package mysql-server-5.5 is not configured yet. dpkg: error processing mysql-server (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: mysql-server-5.5 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) |
#apt-get -f install
Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libgadu3 Use 'apt-get autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded. 2 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up mysql-server-5.5 (5.5.40-0+wheezy1) ... Stopping MySQL database server: mysqld. /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz ... (warning). Starting MySQL database server: mysqld .. Checking for tables which need an upgrade, are corrupt or were not closed cleanly.. Setting up mysql-server (5.5.40-0+wheezy1) ... |
#scp 192.168.10.1:/etc/mysql/my.cnf /etc/mysql/
The authenticity of host '192.168.10.1 (192.168.10.1)' can't be established. ECDSA key fingerprint is 30:a2:28:85:f1:01:64:49:55:d3:19:59:ca:1b:34:c9. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.10.1' (ECDSA) to the list of known hosts. root@192.168.10.1's password: my.cnf 100% 3504 3.4KB/s 00:00 |
#/etc/init.d/mysql stop
Stopping MySQL database server: mysqld. |
#mysqld_safe --init-file /tmp/1
sed: -e expression #1, char 10: unknown option to `s' 141128 15:56:13 mysqld_safe Logging to syslog. 141128 15:56:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 141128 15:56:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended |
#mysql -u root -p
Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) |
#cat /tmp/1
UPDATE mysql.user SET Password=PASSWORD('rootpass') WHERE User='root'; FLUSH PRIVILEGES; |
UPDATE mysql.user SET Password=PASSWORD('rootpass') WHERE User='root'; FLUSH PRIVILEGES;
drop database if exists asterisk; create database asterisk; use asterisk; CREATE TABLE cdr ( calldate datetime NOT NULL default '0000-00-00 00:00:00', clid varchar(80) NOT NULL default '', src varchar(80) NOT NULL default '', dst varchar(80) NOT NULL default '', dcontext varchar(80) NOT NULL default '', channel varchar(80) NOT NULL default '', dstchannel varchar(80) NOT NULL default '', lastapp varchar(80) NOT NULL default '', lastdata varchar(80) NOT NULL default '', duration int(11) NOT NULL default '0', billsec int(11) NOT NULL default '0', disposition varchar(45) NOT NULL default '', amaflags int(11) NOT NULL default '0', accountcode varchar(20) NOT NULL default '', userfield varchar(255) NOT NULL default '', uniqueid varchar(32) NOT NULL default '' ); ALTER TABLE cdr ADD INDEX ( calldate ); ALTER TABLE cdr ADD INDEX ( dst ); ALTER TABLE cdr ADD INDEX ( uniqueid );
Время первой команды журнала | 13:37:43 2014-11-28 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Время последней команды журнала | 14:56:33 2014-11-28 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в журнале | 101 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент команд с ненулевым кодом завершения, % | 11.88 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент синтаксически неверно набранных команд, % | 0.99 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Суммарное время работы с терминалом *, час | 1.31 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в единицу времени, команда/мин | 1.28 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Частота использования команд |
|
В журнал автоматически попадают все команды, данные в любом терминале системы.
Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.
Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
$ l s-l bash: l: command not found |
Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
$ test 5 -lt 4 |
Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
$ find / -name abc find: /home/devi-orig/.gnome2: Keine Berechtigung find: /home/devi-orig/.gnome2_private: Keine Berechtigung find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung find: /home/devi-orig/.metacity: Keine Berechtigung find: /home/devi-orig/.inkscape: Keine Berechtigung ^C |
Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
# id uid=0(root) gid=0(root) Gruppen=0(root) |
Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
$ vi ~/.bashrc
|
Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
$ patch ~/.bashrc |
Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.
Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.
Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.
Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора
Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.
Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.
Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:
$ whoami
user
$ #^ Интересно, кто я?в журнале это будет выглядеть так:
$ whoami
user
Интересно, кто я? |
Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:
$ whoami
user
$ cat > /dev/null #^ Интересно, кто я?
Программа whoami выводит имя пользователя, под которым мы зарегистрировались в системе. - Она не может ответить на вопрос о нашем назначении в этом мире.В журнале это будет выглядеть так:
$ whoami user
|
Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=
1 2 3 4Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.
LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008