下面表格是关于Linux平台下通用的System 巴黎人手
分类:巴黎人-数据库

一.  perror 错误代码查看工具

           在mysql 的运用进度中,大概会冒出琳琅满指标error。那一个error有个别是出于操作系统引起的,比方文件或许目录不真实等等,使用perror的成效就是解说这一个错误代码的详尽含义。  perror 使用办法如下:

*       巴黎人手机版 1
*

    举例:钦定错误号30和60各自是指什么错误
      巴黎人手机版 2
    在MYSQL系统出现故障或错误后,一般客商都会去看错误日志,而不当日志里一般都会开掘那样的谬误编号。那时大家就足以采纳那一个命令解析到底是哪儿出标题了。

 

glibc_error reporting,glibc_error

  很多GNU C库里的函数都会侦测并告知错误条件。大家的次第必要检查实验这几个错误条件。举个例子:我们开拓贰个输入文件时索要判断该文件是还是不是精确的开采。如果未有科学展开,大家要求打字与印刷错误可能利用其余科学的章程。为了接纳这种错误报告机制,大家须要包蕴头文件errno.h

  表压缩工具――myisampack

mysql学习记录(二十四)--mysql相关工具

一、理论:
1.mysql:顾客端连接工具
a.-u:内定客户名
b.-p:钦定密码
c.-host:内定服务器IP大概域名
d.-P:钦定连接端口
e.--default-character-set:客商端字符集选项
f.-e:推行选项
g.-E:将出口情势依照字段顺序展现
h.-f:强制施行sql
i.-v:显示愈来愈多消息
2.myisampack:myisam表压缩工具
3.mysqladmin:mysql管理工科具
4.mysqlbinlog:日志管理工科具
a.-d:指定数据库名称,只列出钦定的数据库相关操作
b.-o:忽略掉日志中的前n行命令
c.-r:将出口的文本格式日志输出到钦命文件
d.-s:呈现轻巧格式,省略掉一部分消息
e.--set-charset=char-name:在输出为文本格式时,在文书首先行上助长set names char-nam(可用来装载数据)
f.--start-datetime=name:内定日期区间内的富有日志
g.--start-position:内定地方间距内的有所日志
5.mysqlcheck:MyISAM表维护工具
a.-c:检查表
b.-r:修复表
c.-a:分析表
d.-o:优化表
6.mysqldump:数据导出工具
a.-u:用户名
b.-p:密码
c.-h:服务器IP恐怕域名
d.-P:连接端口
e.--add-drop-database:各样数据库创立语句前拉长drop database
f.--add-drop-table:在各样表创建语句前拉长drop table
g.-n:不分包数据库的创设语句
h.-t:不带有数据表的创导语句
i.-d:不蕴含数据
j.--compact:不含有私下认可选项中的各样注释
7.mysqlhostcopy:MyISAM表热备份工具
8.mysqlimport:数据导入工具
9.mysqlshow:数据库对象查看工具
10.perror:错误代码查看工具

11.replace:文本替换工具

二、实践:

 

[email protected]:~$ mysql -uroot -p(密码) --default-character-set=utf8
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 47
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, 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> show variables like 'char%';
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8                             |
| character_set_connection | utf8                             |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | utf8                             |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> show variables like 'char%';Ctrl-C -- exit!
Aborted
[email protected]:~$ mysql -uroot -p(密码) --default-character-set=gbk;
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 48
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, 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> show variables like 'char%';
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | gbk                              |
| character_set_connection | gbk                              |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | gbk                              |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> Ctrl-C -- exit!
Aborted
[email protected]:~$ mysql -uroot -p(密码);
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 49
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, 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 sakila;
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

[email protected]:~$ mysql -uroot -p(密码) -e 'use sakila;select * from payment limit 5;';
+------------+-------------+----------+-----------+--------+---------------------+---------------------+
| payment_id | customer_id | staff_id | rental_id | amount | payment_date        | last_update         |
+------------+-------------+----------+-----------+--------+---------------------+---------------------+
|          1 |           1 |        1 |        76 |   2.99 | 2005-05-25 11:30:37 | 2006-02-15 22:12:30 |
|          2 |           1 |        1 |       573 |   0.99 | 2005-05-28 10:35:23 | 2006-02-15 22:12:30 |
|          3 |           1 |        1 |      1185 |   5.99 | 2005-06-15 00:54:12 | 2006-02-15 22:12:30 |
|          4 |           1 |        2 |      1422 |   0.99 | 2005-06-15 18:02:53 | 2006-02-15 22:12:30 |
|          5 |           1 |        2 |      1476 |   9.99 | 2005-06-15 21:08:46 | 2006-02-15 22:12:30 |
+------------+-------------+----------+-----------+--------+---------------------+---------------------+
[email protected]:~$ mysql -uroot -p(密码) -e 'use sakila;select * from payment limit 5;' -E;
*************************** 1. row ***************************
  payment_id: 1
 customer_id: 1
    staff_id: 1
   rental_id: 76
      amount: 2.99
payment_date: 2005-05-25 11:30:37
 last_update: 2006-02-15 22:12:30
*************************** 2. row ***************************
  payment_id: 2
 customer_id: 1
    staff_id: 1
   rental_id: 573
      amount: 0.99
payment_date: 2005-05-28 10:35:23
 last_update: 2006-02-15 22:12:30
*************************** 3. row ***************************
  payment_id: 3
 customer_id: 1
    staff_id: 1
   rental_id: 1185
      amount: 5.99
payment_date: 2005-06-15 00:54:12
 last_update: 2006-02-15 22:12:30
*************************** 4. row ***************************
  payment_id: 4
 customer_id: 1
    staff_id: 2
   rental_id: 1422
      amount: 0.99
payment_date: 2005-06-15 18:02:53
 last_update: 2006-02-15 22:12:30
*************************** 5. row ***************************
  payment_id: 5
 customer_id: 1
    staff_id: 2
   rental_id: 1476
      amount: 9.99
payment_date: 2005-06-15 21:08:46
 last_update: 2006-02-15 22:12:30
[email protected]:~$ cd ~/Downloads/
[email protected]:~/Downloads$ mkdir mysql
[email protected]:~/Downloads$ cd mysql/
[email protected]:~/Downloads/mysql$ vi a.sql;
(在此步添加了一些内容)
[email protected]:~/Downloads/mysql$ more a.sql;
insert into t2 values (1);
insert into t2 values (2222222222222222222222222);
insert into t2 values (3);
[email protected]:~/Downloads/mysql$ mysql -uroot -p(密码);
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 53
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, 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 test;
Database changed
mysql> create table t2(
    -> id int(11)
    -> ) engine = innodb charset = utf8;
Query OK, 0 rows affected (0.05 sec)

mysql> Ctrl-C -- exit!
Aborted
[email protected]:~/Downloads/mysql$ mysql -uroot -p(密码) test < a.sql;
ERROR 1054 (42S22) at line 2: Unknown column '2a' in 'field list'
[email protected]:~/Downloads/mysql$ mysql -uroot -p(密码) test -e 'select * from t2';
+------+
| id   |
+------+
|    1 |
+------+
[email protected]:~/Downloads/mysql$ mysql -uroot -p(密码) test -f < a.sql 
ERROR 1054 (42S22) at line 2: Unknown column '2a' in 'field list'
[email protected]:~/Downloads/mysql$ mysql -uroot -p(密码) test -e 'select * from t2';
+------+
| id   |
+------+
|    1 |
|    3 |
+------+
[email protected]:~/Downloads/mysql$ mysql -uroot -p(密码) test -f -v ~/test.txt;
[email protected]:/usr/local/mysql/bin$ cd ~/
[email protected]:~$ more ~/test.txt 
-- MySQL dump 10.13  Distrib 5.5.44, for Linux (x86_64)
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version 5.5.44-log

/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @[email protected]@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `t2`
--

DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t2`
--

LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET [email protected]_TIME_ZONE */;

/*!40101 SET [email protected]_SQL_MODE */;
/*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
/*!40014 SET [email protected]_UNIQUE_CHECKS */;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
/*!40111 SET [email protected]_SQL_NOTES */;

-- Dump completed on 2015-11-06  5:15:01
[email protected]:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact -d test t2 > ~/Downloads//t2.txt
[email protected]:/usr/local/mysql/bin$ more ~/Downloads/t2.txt;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
[email protected]:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact -c test t2 > ~/Downloads/t2c.txt
[email protected]:/usr/local/mysql/bin$ more ~/Downloads/t2c.txt
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` (`id`) VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);

[email protected]:/usr/local/mysql/bin$ mysqld --verbose --help | grep 'default-character-set' | grep -v name ;
151106  5:18:52 [Warning] option 'table_definition_cache': unsigned value 100 adjusted to 400
151106  5:18:52 [Note] mysqld (mysqld 5.5.44-log) starting as process 74255 ...
151106  5:18:52 [Warning] Can't create test file /usr/local/mysql/data/ubuntu.lower-test
151106  5:18:52 [Warning] Can't create test file /usr/local/mysql/data/ubuntu.lower-test
151106  5:18:52 [Warning] One can only use the --user switch if running as root

mysqld: File '/usr/local/mysql/data/mysql-bin.index' not found (Errcode: 13)
151106  5:18:52 [ERROR] Aborting

[email protected]:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact test t2 > ~/Downloads/testA.txt
[email protected]:/usr/local/mysql/bin$ more ~/Downloads/testA.txt 
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);
[email protected]:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact --default-character-set=latin1 test t2 > ~/Downloads/testA.txt
[email protected]:/usr/local/mysql/bin$ more ~/Downloads/testA.txt 
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);

[email protected]:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码);
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| test               |
| test1              |
+--------------------+
[email protected]:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码) --count;
+--------------------+--------+--------------+
|     Databases      | Tables |  Total Rows  |
+--------------------+--------+--------------+
| information_schema |     40 |        20863 |
| mysql              |     24 |         2214 |
| performance_schema |     17 |           14 |
| sakila             |     33 |        50132 |
| test               |      1 |           13 |
| test1              |     20 |           67 |
+--------------------+--------+--------------+
6 rows in set.
[email protected]:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码) test --count;
Database: test
+--------+----------+------------+
| Tables | Columns  | Total Rows |
+--------+----------+------------+
| t2     |        1 |         13 |
+--------+----------+------------+
1 row in set.

[email protected]:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码) test a --count;
mysqlshow: Cannot get record count for db: test, table: a: Table 'test.a' doesn't exist
[email protected]:~/Downloads$ more t2c.txt
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` (`id`) VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);
[email protected]:~/Downloads$ mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| test               |
+--------------------+
[email protected]:~/Downloads$ mysqlshow -uroot -p(密码) test t2 --count;
Database: test  Table: t2  Rows: 13
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type    | Collation | Null | Key | Default | Extra | Privileges                      | Comment |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| id    | int(11) |           | YES  |     |         |       | select,insert,update,references |         |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
[email protected]:~/Downloads$ mysql -uroot -p(密码);
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 88
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, 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 sakila;
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
[email protected]:~/Downloads$ mysqlshow -uroot -p(密码) test t2 -k;
Database: test  Table: t2
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type    | Collation | Null | Key | Default | Extra | Privileges                      | Comment |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| id    | int(11) |           | YES  |     |         |       | select,insert,update,references |         |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
Table has no keys
[email protected]:~/Downloads$ mysqlshow -uroot -p(密码) sakila actor -k;
Database: sakila  Table: actor
+-------------+----------------------+-----------------+------+-----+-------------------+-----------------------------+---------------------------------+---------+
| Field       | Type                 | Collation       | Null | Key | Default           | Extra                       | Privileges                      | Comment |
+-------------+----------------------+-----------------+------+-----+-------------------+-----------------------------+---------------------------------+---------+
| actor_id    | smallint(5) unsigned |                 | NO   | PRI |                   | auto_increment              | select,insert,update,references |         |
| first_name  | varchar(45)          | utf8_general_ci | NO   |     |                   |                             | select,insert,update,references |         |
| last_name   | varchar(45)          | utf8_general_ci | NO   | MUL |                   |                             | select,insert,update,references |         |
| last_update | timestamp            |                 | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | select,insert,update,references |         |
+-------------+----------------------+-----------------+------+-----+-------------------+-----------------------------+---------------------------------+---------+
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name            | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| actor | 0          | PRIMARY             | 1            | actor_id    | A         | 201         |          |        |      | BTREE      |         |               |
| actor | 1          | idx_actor_last_name | 1            | last_name   | A         | 201         |          |        |      | BTREE      |         |               |
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

一、理论: 1.mysql:顾客端连接工具 a.-u:钦定顾客名 b.-p:钦赐密码 c.-host:钦赐服务器IP或然域名 d.-P:指...

二 总结

       在近期几章中讲到了常用的多少个工具,其实还会有像replace (sql文本字符替换工具),那些今后用的时候在查阅表明。 mysqlimport(数据导入工具)后续会在讲到。mysqlhotcopy(MyISAM表热备份工具)那一个只针对MyISAM存款和储蓄引擎的表,就不在表明。末了熟知使用那个工具,将会推动极大方便。

 

检查测验错误:

  非常多库函数都会回去二个奇特的值来体现函数运转出错。常见的出格值有:-1、空指针、EOF常量。不过这么些重回值只可以告诉您有错误产生,但不会告知你错误是哪些。倘让你想知道不当是什么样,就得靠错误代码,错误代码存款和储蓄在变量errno中(在errno.h中有扬言)

  errno变量满含了系统错误代码,其项目是volatile。该类型意味着其得以溘然被异步线程改换,编写翻译器从不就算其值。即便你在写复信号管理程序应当保留改造量的值并还原其值。

  errno的开始值为0,蒙受错误时,errno绝无或然为0。但未曾错误的时候,errno也不自然为0(库函数在功成名就运营时并不会修改errno的值)。所以,不要依赖errno的值来判别错误是还是不是爆发。正确的做法是为每多少个函数做好文书档案,标记出错误代码的值对应的错误类型。这样调用失败时,你可以通过检查errno获取错误代码,然后查询函数文书档案获取错误实际情况。就算您想博得某一库函数的错误代码,最佳再次在此之前安装errno为0(可能你还想先保存以下errno的值,然后便于恢复生机该值)。

  每三个错误代码都有贰个以E伊始紧跟大写字母或数字的标志名,实际为定义在errno.h中的宏。当然不是怀有的宏都定义在贰个errno.h中(详细的能够团结翻一翻头文件,注意不唯有唯有三个errno.h,多个errno.h共同定义了全副的宏)

  错误代码的值一般为正数况兼都不一致样,但也可以有贰个不如:EWOPRADOLDBLOCK和EAGAIN的错误代码是均等的。除了EWO景逸SUVLDBLOCK和EAGAIN,你能够运用switch语句来判别错误代码。但您不应当借助于此,你独一能够依赖的正是文书档案。

  除了GNU/Hurd系统,大致全数的系统调用被传到三个不行指针时都会回来EFAULT。所以啊,glibc的函数库表明文书档案中屡次会轻松对EFAULT的解释。

  大多数的错误代码宏名都分明的好懂,纵然实际不知其意能够查看手册恐怕

~# man errno

此间差不离提多少个宏:

Macro: int EDOM
    域错误,可以理解为定义域错误。主要用在数学函数中。如果数学函数的一个参数值不在函数定义域中,则会将errno设置为EDOM

Macro: int ERANGE
    范围错误,与上面的EDOM恰好相反。EDOM是定义域的话,ERANGER就是值域了。也多用于数学函数中。如果数学函数返回值超过了约定的返回,则会将errno设置为ERANGE

Macro: int EAGAIN
    资源暂时不可获得。这种错误可能是随机的,你再次运行的时候便好了。。。EWOULDBLOCK是EAGAIN的一个别名。

 

  Mysqlshow是客商端对象查看工具,用来飞快地搜寻存在哪些数据库、数据库中的表、表中的列或索引。

[root@DB-Server ~]# perror 2;

不当音讯:

  大家领略错误代码,但总以为查文书档案不低价。幸亏库文件给大家提供了错误新闻告诉函数。那些函数能够告知叁个享有表达性的失实消息。部分音讯告诉函数大家得以友善定义消息格式。

  函数strerror和perror为每二个错误代码都提供了八个行业内部的一无所长音讯。而变量program_invocation_short_name则能够一本万利获取程序的名字,告诉大家哪个程序出错。

多少个函数原型:

#include <string.h>
char * strerror(int errnum);
char *strerror_r(int errnum, char *buf, size_t n);

说明:  strerror和strerror_r八个函数大约。分裂在于安全性,官方文书档案对strerror的注释是MT-Unsafe race:strerror,而strerror_r则为MT-Safe。strerror重返三个静态申请的字符串缓冲区,该缓冲区被有着线程分享。而strerror_r再次回到的是三个私有别本,并不被别的线程分享。别的那多少个函数皆有望导致内部存款和储蓄器溢出(静态申请的缓冲区)。尽管strerror_r能够内定字符串长度,但那长度是char *buf的。这函数有八个重临值,二个运用reurn重返,还会有一个是char *buf。return重回的依旧是一个静态缓冲区。

 

#include<stdio.h>
void perror(const char *message);

表明:  perror将error message打字与印刷到专门的职业错误输出中。假设你传进的参数是二个空指针,perror会依照errno打字与印刷错误音信。借使char *message非空,perror会将message当作错误消息的前缀输出。perror得及时调用,不然errno的值或然爆发变化。

 

char *program_invocation_name; //等同于argv[0]
char *program_invocation_short_name //不包含目录名。

证实:  这四个变量的初始化专门的学业由glibc库在还未调用main函数此前施行。所以在非GNU库中,那多少个变量不起功能,在其实代码中大家供给定义_GNU_SOURCE宏,告诉编写翻译器使用GNU库。

  以下五个函数在总体GNU project中采取非常常见。

void error(int status, int errnum, const char *format, ...);
void error_at_line(int status, int errnum, const char *fname, unsigned int lineno, const char *format, ...);

证实:  那多个函数的回来和status有关,借使status是0,则平常格式化打字与印刷错误新闻。全局变量error_message_count也会做自增操作。错误新闻的格式如下:program_name: format_string: error_messager_for_errnon。如若status非零,那七个函数将调用exit status,即以状态status退出(不会回到)。关于program_name:全局变量error_print_progname指向的函数决定了program_name的值。error_at_line函数有一些特别:多了fname,lineno五个参数。错误音讯格式如下:program_name:fname:lineno format_string: error_mesage_for_errnon。如若全局变量error_one_per_line被设置为非零值,每一行只会打印三个谬误消息。

  除了以上的一无所长音讯函数,我们还会有以下多少个:那多少个函数首要用在BSD系统中,定义在头文件err.h中,在gnu系统中不引入使用。

void warn(const char *format, ...)
void vwarn(const char *format, va_list ap)
void warnx(const char *format, ...)
void vwarnx(const char *format, va_list ap)
void err(int status, const char *format, ...)
void verr(int status, const char *format, va_list ap)
void errx(int status, const char *format, ...)
void verrx(int status, const char *format, va_list ap)

各位看官自行查看手册吧。just be a man!!!

reporting,glibc_error 相当多GNU CCurry的函数都会侦测并告知错误条件。我们的主次需求检验这么些错误条件。举个例子:大家开荒贰个输入文...

  参考资料:

OS error code   3:  No such process

  [mysql]Show Full Processlist

InnoDB: Operating system error number 0.

  

 

  Mysqlreport是一款帮助周期生成报表的工具。

 

  数据导出工具――mysqldump

 

  2、DMS(数据操作描述):种种数据操作布满(select、update等)、查询和排序次数遍及

OS error code   6:  No such device or address

  监察和控制工具――Mysqlsla

[root@DB-Server ~]#

  更加大胆的是,能够在实行进度中能够查阅各类线程的实市场价格况、查看死锁消息;

OS error code  10:  No child processes

  Query sample sql语句

 

  由于上述参数复杂,因而监察和控制工具收取主要的音讯,以有利于查看的方法展示,并记下都在日记中。

 

  与上诉的多少个工具不一致,那是叁个好像于top的工具,能够实时显示innodb的各类参数变化。

[root@DB-Server ~]# perror 4;

  参照他事他说加以考察资料:

OS error code   1:  Operation not permitted

  参照他事他说加以考察资料:

  借使是集群,那么能够shell> perror --ndb errorcode查看, 下边表格是有关Linux平台下通用的System Error Code列表,如下所示,大可不必硬性记住。蒙受查看就能够。

  Mysql提供了一层层命令来取得数据库的运作情形,在那之中最常用的显要有show status;show innodb status;show processlist; show mutex status。通过那一个命令大家能够领会到数据库和积累引擎io,内部存款和储蓄器,锁等详细音讯。

本文由巴黎人手机版发布于巴黎人-数据库,转载请注明出处:下面表格是关于Linux平台下通用的System 巴黎人手

上一篇:没有了 下一篇:没有了
猜你喜欢
热门排行
精彩图文