• MySQL初始化以及客户端工具的使用


                          MySQL初始化以及客户端工具的使用

                                                作者:尹正杰

    版权声明:原创作品,谢绝转载!否则将追究法律责任。

    一.什么是关系型数据库
      关系型数据库通常是把所有的数据都组织成二维关系。之所以称为关系型数据库是因为他把数据组织在一个有字段和记录组成的二维关系表当中。并且在这个关系表之外提供了很多辅助性的工具以完成关系表中的关系的维持及数据访问等功能。
      我们知道如果将数据存储为字符形式的时候有文本对象和二进制大对象。二进制大对象不会直接存储在数据库中,而是放在服务器的某一个路径上,而在数据库存储的知识该数据的指针。比如,存取一张高清壁纸,它不会将这个图片的内容直接写入数据库,而是将这个图片的绝对路径存放在数据库中的某一个字段内。这种关系我们称之为面向对象的关系型数据库。(RDBMS)。而现在很多关系型数据库还支持直接将xml格式的接口进行交互。
     
    二.关系型数据库的分支
      在90年代初,关系型数据库由Sybase,Informix,Oracle三家公司三足鼎立。这三家公司对公司的规划不同,Sybase和Informix的规划都是很有前瞻性的,而Oracle的目标很有精确,就是把它们的产品做好,最后Oracle不断地进行完善,很显然,走到最靠前的当然是Oracle。其中Sybase曾经是和Microsoft公司合作,当时处于某种原因Sybase退出和Microsoft公司的合作,最后Microsoft公司自己研发了SQL Server数据库,Informix公司则被IBM公司收购,现在Informix只是IBM的一个子项目公司,典型的数据库代表就是DB2。
      早期MySQL是ab公司的,最后以10美元卖给了sun公司,不幸的是sun公司被Oracle公司收购了,而Oracle惯用的伎俩就是将竞争对手买下来再打入冷宫。所以在资本主义面前谈理想都是道德主义。sun公司被收购之后,MySQL也就归Oracle公司啦。Oracle和人们预想的一样,虽然在收购的时候承诺了5年之内不下手,但事实上在这期间MySQL以及被蹂躏了无数遍啦。所以像之前谷歌,Facebook等公司也从MySQL软件转向其他软件啦。而且在RHEL7版本的默认数据库已经将MySQL换成了MariaDB。
      MySQL的原作者在sum公司被收购之后久另立门户了,在早起的MySQL的基础上提出了另外的一个分支叫MariaDB。事实上MariaDB在能够兼容mysql的基础上还整合了开源社区中的很强大的技术力量。我们知道mysql早起整合进来的存储引擎有一个是innodb,而innodb是属于innobase公司的,innobase公司早在2008年被Oracle收购啦。有幸的是在开源界总是不乏奇人的,比如说著名的percona公司,它是致力于mysql的优化方面已经取得了不菲成绩的一个组织,这个组织在早起的改进开源的innodb基础之上研发了增强版的innodb,命名为xtradb。如你所料,MariaDB的存储引擎就是用的xtradb。我们可以理解为MariaDB是MySQL进化之后的一个产品。google和Facebook等著名的世界互联网公司都很看好MariaDB并已经开始使用该软件啦。
      其实google和Facebook还有其他的几家公司在早起的MySQL的技术理念的不同他们也开发了另一个互联网产品叫做webscaledb,专门为web而生的一个数据库系统。它柔和了MySQL,MariaDB,percona和innobase四家公司的技术的产品。
      在开源的数据库产品中还有一个重要的产品叫做PostgreSQL(简称pgsql),事实上,早起名字叫做egresql,只是egresql在商业运作上跟Oracle竞争时完全败下阵来。以至于它销声匿迹的比Informix还要早。而事实上就关系型数据库来讲,pgsql在技术上要优秀的多。不过市场决定一切,因此MySQL可能是大家接触比较多的关系型数据库。
      指定一提的另外一个关系型数据库叫做sqlite,它和mysql不一样,我们知道mysql是基于c/s架构,客户端和服务端是通过mysql协议进行通信的。而sqlite是一个简单,工作在本地,非服务化的一个API的关系型数据库接口(它的客户端和服务端是一体的)。注意,sqlite仅是一个引擎,sqlite主要用在嵌入式平台上又不得不用关系型数据库接口的这样的应用场景。再次强调一下,sqlite是一个非C./S架构,它纯粹是一个引擎API机制,背后的数据任然存储为文件系统上的简单文件,不做过多解析,但完全可以支持我们的程序员使用select,insert等机制对数据完成持久化。
     
     
     
    三.MySQL的初始化
      我们知道MySQL的安装方式有很多种,比如rpm,yum,源码安装,二进制方式安装MySQL等等。但是无论哪种方式安装的MySQL我们都需要做一个操作就是MySQL的初始化。而正确的初始化姿势我们分为两个操作。第一,提供配置文件;第二,删除匿名用户等等。
     
    1.提供配置文件
      相比之前接触过MySQL的童鞋都知道,MySQL默认的配置文件都是以“*.cnf”结尾的文件,它是集中式的配置文件,多个应用程序共用的配置文件。当然,也可以不这样玩,后期我会分享案例给大家。我们通过一条命令就可以查看MySQL的一些默认信息。即“[root@yinzhengjie ~]# mysql --help --verbose ”没错,通过这个命令我们就可以或得很多输出:
      A>.显示mysqld程序启动时可用的选项,通常都是长选项;
      B>.显示mysqld的配置文件中可用的服务变量;
      C>.显示使用配置文件的方式,即:第一,它依次查找每个需要查找的文件,结果是所有文件并集;第二,如果某参数在多个文件中出现多次,后读取的最终生效。
     
    2.重置用户信息
      大家知道在一个新安装的服务器上有很多默认的用户,比如root以及一些匿名用户,他们都是没有密码的,这样是很不安全的,因此我们需要删除不必要的用户,以及给我们需要使用的用户设置密码以及授权操作。 我们知道MySQL用户名账号由两部分组成,即用户名和主机名(username@host),其中“host”还可以使用通配符。如 “%”表示任意长度的任意字符,“_”表示匹配任意单个字符。
    A.删除匿名用户
     1 mysql> select user,host,password from user;
     2 +-------------+-------------+-------------------------------------------+
     3 | user        | host        | password                                  |
     4 +-------------+-------------+-------------------------------------------+
     5 | root        | localhost   |                                           |
     6 | root        | yinzhengjie |                                           |
     7 | root        | 127.0.0.1   |                                           |
     8 |             | localhost   |                                           |
     9 |             | yinzhengjie |                                           |
    10 | yinzhengjie | 10.%.%.%    | *C260A4F79FA905AF65142FFE0B9A14FE0E1519CC |
    11 +-------------+-------------+-------------------------------------------+
    12 6 rows in set (0.00 sec)
    13 
    14 mysql> 
    15 mysql> 
    16 mysql> 
    17 mysql> 
    18 mysql> drop user ""@localhost;
    19 Query OK, 0 rows affected (0.01 sec)
    20 
    21 mysql> drop user ""@yinzhengjie;
    22 Query OK, 0 rows affected (0.00 sec)
    23 
    24 mysql> select user,host,password from user;
    25 +-------------+-------------+-------------------------------------------+
    26 | user        | host        | password                                  |
    27 +-------------+-------------+-------------------------------------------+
    28 | root        | localhost   |                                           |
    29 | root        | yinzhengjie |                                           |
    30 | root        | 127.0.0.1   |                                           |
    31 | yinzhengjie | 10.%.%.%    | *C260A4F79FA905AF65142FFE0B9A14FE0E1519CC |
    32 +-------------+-------------+-------------------------------------------+
    33 4 rows in set (0.00 sec)
    34 
    35 mysql> 
    B.给所有的root用户设置密码
    1 第一种方式:
    2   mysql > set password for username@host = password( 'your_password');
    3 第二种方法
    4   mysql > update user set password = password('your_password') where user = 'root';
    5   mysql > flush peivileges;
    6 第三种方式:
    7 [root@yinzhengjie ~]#mysqladmin -u UserName -h Host password 'new_password' -p
    8 [root@yinzhengjie ~]#mysqladmin -u UserName -h Host -p flush-privileges
     
    四.连入MySQL服务器
    1.MySQL协议
      MySQL的客户端有很多种,不论是那种MySQL客户端连接mysqld服务器,都是需要使用mysql protocol协议。
     
    2.MySQL接收连接请求
    本地通信:
      客户端与服务器端位于同一主机,而且还要基于127.0.0.1(localhost)地址或lo接口进行通信。Linux或是Unix操作系统则是通过Unix Sock,/tmp/mysql.scok,/var/lib/mysql/mysql.sock这些本地文件进行进程间的通信。Widows则是通过memory(共享内存) pipe(命名管道)的方式进行通信的。
    远程通信:
      客户端与服务器位于不同的主机,或在统一主机便使用非回环地址通信。而远程通信时,通常是基于套接字通信,即TCP Socket。
     
    3.MySQL客户端工具
      事实上MySQL的客户端工具有很多种,可不止mysql这一种哟(只不过mysql这个客户端时最著名的一个)。其他著名的客户端工具还有:mysqladmin,mysqldump,mysqlcheck等等。
      客户端([client])通信的选项:
        指定用户 : -u,--user=
        指定主机名 : -h, --host=
        指定密码 : -p, --password=
        指定协议 : --protocol={tcp|socket|memory|pipe}
        指定端口 : --port= #MySQL默认是3306端口
        指定套接字 : --socket= # 例如:/tmp/mysql.sock
      非客户端类的管理工具:myisamchk(监测工具)和myisampack(打包工具)。
     
    4.mysql命令行选项
      压缩传输 : -compress
      字符集 : --default-character-set
      显示版本号 : -V:
      显示详细信息 : -v:
      指定ca证书 : --ssl-ca
      ca证书的文件夹: --ssl-capath (一般有多个CA证书,就可以指定一个目录)
      客户端证书 : --ssl-cert
      加密方式 : --ssl-cipher
      使用的私钥 : --ssl-key
      验证服务器端证书: --ssl-verify-server-cert
      指定要使用的数据库:--database= -D
      输出结果为html格式的文档::-H --html
      输出结果为xml格式的文档: -X --xml:
      发送命令时拒绝使用无where字句的uodate或delete命令: --safe-updates
     
    5.mysql命令提示符
      mysql>      ---->等待输入命令
      '>         ---->前面提供的‘未提供结束’,接下来那两行一样的道理。
      ”> 
      `> 
      —>     ---->续航提示符
      /*>      ---->注释信息(结束就用户"*/",比如:/*yinzhengjie*>)
     
    6.mysql的命令行编辑快捷键
      ctrl+w:删除光标所在处之前的一个单词
      ctrl+u:删除光标之前至行首的所有内容,并将其保存在缓存(buffer)当中。
      ctrl+y:粘贴之前ctrl+w或ctrl+u删除的内容
      ctrl+a:移动光标至行首
      ctrl+e:移动光标至行尾
     
     五.mysqladmin工具用法详解
       mysqladmin可以让用户不进入mysql的交互界面,直接在命令行就可以运行SQL语句啦。命令格式:“mysqladmin [options] command [arg] [command[arg]] .....”,接下来,让我们一起研究一下mysqladmin的用法。这个命令其实很有用,尤其是你在写shell脚本的时候,操作数据的时候它的用法就可以大展身手了。
     
    1.创建空数据库
     1 [root@yinzhengjie ~]# mysqladmin create yinzhengjiedb    #创建一个叫yinzhengjiedb的数据库。
     2 [root@yinzhengjie ~]# mysql -e 'show databases;'       #我们可以用mysql的-e选项来进行验证是否创建成功、
     3 +--------------------+
     4 | Database           |
     5 +--------------------+
     6 | information_schema |
     7 | mysql              |
     8 | test               |
     9 | yinzhengjie        |
    10 | yinzhengjiedb      |
    11 +--------------------+
    12 [root@yinzhengjie ~]# 

    2.删除数据库

     1 [root@yinzhengjie ~]# mysql -e 'show databases;'
     2 +--------------------+
     3 | Database           |
     4 +--------------------+
     5 | information_schema |
     6 | mysql              |
     7 | test               |
     8 | yinzhengjie        |
     9 | yinzhengjiedb      |
    10 +--------------------+
    11 [root@yinzhengjie ~]# mysqladmin drop yinzhengjiedb
    12 Dropping the database is potentially a very bad thing to do.
    13 Any data stored in the database will be destroyed.
    14 
    15 Do you really want to drop the 'yinzhengjiedb' database [y/N] y   #此处我们需要交互式输入一个y。
    16 Database "yinzhengjiedb" dropped
    17 [root@yinzhengjie ~]# mysql -e 'show databases;'
    18 +--------------------+
    19 | Database           |
    20 +--------------------+
    21 | information_schema |
    22 | mysql              |
    23 | test               |
    24 | yinzhengjie        |
    25 +--------------------+
    26 [root@yinzhengjie ~]# 

     3.输出MySQL简要状态信息

     1 [root@yinzhengjie ~]# mysqladmin status   #输出简要状态信息
     2 Uptime: 232451  Threads: 1  Questions: 228  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
     3 [root@yinzhengjie ~]# 
     4 [root@yinzhengjie ~]# mysqladmin status --sleep 1 --count 5   #表示每个1秒刷新一次,总共打印5次
     5 Uptime: 232465  Threads: 1  Questions: 229  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
     6 Uptime: 232466  Threads: 1  Questions: 229  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
     7 Uptime: 232467  Threads: 1  Questions: 229  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
     8 Uptime: 232468  Threads: 1  Questions: 229  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
     9 Uptime: 232469  Threads: 1  Questions: 229  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    10 [root@yinzhengjie ~]# 
    11 [root@yinzhengjie ~]# 
    12 [root@yinzhengjie ~]# mysqladmin status --sleep 1       #表示每秒刷新一次,可以安装Ctrl+C 结束
    13 Uptime: 232474  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    14 Uptime: 232475  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    15 Uptime: 232476  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    16 Uptime: 232477  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    17 Uptime: 232478  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    18 Uptime: 232479  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    19 Uptime: 232480  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    20 Uptime: 232481  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    21 Uptime: 232482  Threads: 1  Questions: 230  Slow queries: 0  Opens: 41  Flush tables: 1  Open tables: 34  Queries per second avg: 0.0
    22 ^C[root@yinzhengjie ~]# 

    4.debug 调试信息用法展示

      1 [root@yinzhengjie ~]# more /var/log/mysqld.log 
      2 [root@yinzhengjie ~]# 
      3 [root@yinzhengjie ~]# mysqladmin debug
      4 [root@yinzhengjie ~]# more /var/log/mysqld.log 
      5 
      6 Memory status:
      7 Non-mmapped space allocated from system: 6066176
      8 Number of free chunks:                   12
      9 Number of fastbin blocks:                0
     10 Number of mmapped regions:               11
     11 Space in mmapped regions:                23597056
     12 Maximum total allocated space:           0
     13 Space available in freed fastbin blocks: 0
     14 Total allocated space:                   6010288
     15 Total free space:                        55888
     16 Top-most, releasable space:              45424
     17 Estimated memory (with thread stack):    29925376
     18 
     19 
     20 
     21 Events status:
     22 LLA = Last Locked At  LUA = Last Unlocked At
     23 WOC = Waiting On Condition  DL = Data Locked
     24 
     25 Event scheduler status:
     26 State      : INITIALIZED
     27 Thread id  : 0
     28 LLA        : n/a:0
     29 LUA        : n/a:0
     30 WOC        : NO
     31 Workers    : 0
     32 Executed   : 0
     33 Data locked: NO
     34 
     35 Event queue status:
     36 Element count   : 0
     37 Data locked     : NO
     38 Attempting lock : NO
     39 LLA             : drop_schema_events:375
     40 LUA             : drop_schema_events:377
     41 WOC             : NO
     42 Next activation : never
     43 
     44 Status information:
     45 
     46 Current dir: /var/lib/mysql/
     47 Running threads: 1  Stack size: 262144
     48 Current locks:
     49 lock: 0x7f7740089338:
     50 
     51 lock: 0x7f7740086ee8:
     52 
     53 lock: 0x7f77400847b8:
     54 
     55 lock: 0x7f77400823f8:
     56 
     57 lock: 0x7f7740080488:
     58 
     59 lock: 0x7f774007f398:
     60 
     61 lock: 0x7f7740072028:
     62 
     63 lock: 0x7f774006ba58:
     64 
     65 lock: 0x7f7740069368:
     66 
     67 lock: 0x7f7740065678:
     68 
     69 lock: 0x7f7740061a98:
     70 
     71 lock: 0x7f774005ede8:
     72 
     73 lock: 0x7f774005b838:
     74 
     75 lock: 0x7f77400595c8:
     76 
     77 lock: 0x7f774004ed08:
     78 
     79 lock: 0x7f774004a758:
     80 
     81 lock: 0x7f7740044c38:
     82 
     83 lock: 0x7f77400400b8:
     84 
     85 lock: 0x7f77400377c8:
     86 
     87 lock: 0x7f7740031ed8:
     88 
     89 lock: 0x7f7740029c08:
     90 
     91 lock: 0x7f7740027cf8:
     92 
     93 lock: 0x7f7740024308:
     94 
     95 lock: 0x7f774001e728:
     96 
     97 lock: 0x7f77400158e8:
     98 
     99 lock: 0x7f774000ceb8:
    100 
    101 lock: 0x291f5f8:
    102 
    103 lock: 0x29148c8:
    104 
    105 lock: 0x2909d28:
    106 
    107 lock: 0x2900de8:
    108 
    109 lock: 0x28f65f8:
    110 
    111 lock: 0x28e6f58:
    112 
    113 lock: 0x28e1098:
    114 
    115 lock: 0x28d93f8:
    116 
    117 
    118 Key caches:
    119 default
    120 Buffer_size:       8384512
    121 Block_size:           1024
    122 Division_limit:        100
    123 Age_limit:             300
    124 blocks used:            13
    125 not flushed:             0
    126 w_requests:              4
    127 writes:                  2
    128 r_requests:            284
    129 reads:                  13
    130 
    131 
    132 handler status:
    133 read_key:           80
    134 read_next:         126
    135 read_rnd           126
    136 read_first:         80
    137 write:              70
    138 delete               2
    139 update:              0
    140 
    141 Table status:
    142 Opened tables:         41
    143 Open tables:           34
    144 Open files:            68
    145 Open streams:           0
    146 
    147 Alarm status:
    148 Active alarms:   0
    149 Max used alarms: 1
    150 Next alarm time: 0
    151 
    152 Begin safemalloc memory dump:
    153 
    154 End safemalloc memory dump.
    155 [root@yinzhengjie ~]# 
    debug 打开调试日志并记录与error log中

    5.extended-status用法展示

      1 [root@yinzhengjie ~]# mysqladmin extended-status
      2 +-----------------------------------+----------+
      3 | Variable_name                     | Value    |
      4 +-----------------------------------+----------+
      5 | Aborted_clients                   | 0        |
      6 | Aborted_connects                  | 0        |
      7 | Binlog_cache_disk_use             | 0        |
      8 | Binlog_cache_use                  | 0        |
      9 | Bytes_received                    | 19009    |
     10 | Bytes_sent                        | 200183   |
     11 | Com_admin_commands                | 3        |
     12 | Com_assign_to_keycache            | 0        |
     13 | Com_alter_db                      | 0        |
     14 | Com_alter_db_upgrade              | 0        |
     15 | Com_alter_event                   | 0        |
     16 | Com_alter_function                | 0        |
     17 | Com_alter_procedure               | 0        |
     18 | Com_alter_server                  | 0        |
     19 | Com_alter_table                   | 0        |
     20 | Com_alter_tablespace              | 0        |
     21 | Com_analyze                       | 0        |
     22 | Com_backup_table                  | 0        |
     23 | Com_begin                         | 0        |
     24 | Com_binlog                        | 0        |
     25 | Com_call_procedure                | 0        |
     26 | Com_change_db                     | 10       |
     27 | Com_change_master                 | 0        |
     28 | Com_check                         | 0        |
     29 | Com_checksum                      | 0        |
     30 | Com_commit                        | 0        |
     31 | Com_create_db                     | 1        |
     32 | Com_create_event                  | 0        |
     33 | Com_create_function               | 0        |
     34 | Com_create_index                  | 0        |
     35 | Com_create_procedure              | 0        |
     36 | Com_create_server                 | 0        |
     37 | Com_create_table                  | 0        |
     38 | Com_create_trigger                | 0        |
     39 | Com_create_udf                    | 0        |
     40 | Com_create_user                   | 0        |
     41 | Com_create_view                   | 0        |
     42 | Com_dealloc_sql                   | 0        |
     43 | Com_delete                        | 0        |
     44 | Com_delete_multi                  | 0        |
     45 | Com_do                            | 0        |
     46 | Com_drop_db                       | 1        |
     47 | Com_drop_event                    | 0        |
     48 | Com_drop_function                 | 0        |
     49 | Com_drop_index                    | 0        |
     50 | Com_drop_procedure                | 0        |
     51 | Com_drop_server                   | 0        |
     52 | Com_drop_table                    | 0        |
     53 | Com_drop_trigger                  | 0        |
     54 | Com_drop_user                     | 2        |
     55 | Com_drop_view                     | 0        |
     56 | Com_empty_query                   | 0        |
     57 | Com_execute_sql                   | 0        |
     58 | Com_flush                         | 0        |
     59 | Com_grant                         | 0        |
     60 | Com_ha_close                      | 0        |
     61 | Com_ha_open                       | 0        |
     62 | Com_ha_read                       | 0        |
     63 | Com_help                          | 0        |
     64 | Com_insert                        | 0        |
     65 | Com_insert_select                 | 0        |
     66 | Com_install_plugin                | 0        |
     67 | Com_kill                          | 0        |
     68 | Com_load                          | 0        |
     69 | Com_load_master_data              | 0        |
     70 | Com_load_master_table             | 0        |
     71 | Com_lock_tables                   | 0        |
     72 | Com_optimize                      | 0        |
     73 | Com_preload_keys                  | 0        |
     74 | Com_prepare_sql                   | 0        |
     75 | Com_purge                         | 0        |
     76 | Com_purge_before_date             | 0        |
     77 | Com_release_savepoint             | 0        |
     78 | Com_rename_table                  | 0        |
     79 | Com_rename_user                   | 0        |
     80 | Com_repair                        | 0        |
     81 | Com_replace                       | 0        |
     82 | Com_replace_select                | 0        |
     83 | Com_reset                         | 0        |
     84 | Com_restore_table                 | 0        |
     85 | Com_revoke                        | 0        |
     86 | Com_revoke_all                    | 0        |
     87 | Com_rollback                      | 0        |
     88 | Com_rollback_to_savepoint         | 0        |
     89 | Com_savepoint                     | 0        |
     90 | Com_select                        | 148      |
     91 | Com_set_option                    | 21       |
     92 | Com_show_authors                  | 0        |
     93 | Com_show_binlog_events            | 0        |
     94 | Com_show_binlogs                  | 0        |
     95 | Com_show_charsets                 | 0        |
     96 | Com_show_collations               | 0        |
     97 | Com_show_column_types             | 0        |
     98 | Com_show_contributors             | 0        |
     99 | Com_show_create_db                | 0        |
    100 | Com_show_create_event             | 0        |
    101 | Com_show_create_func              | 0        |
    102 | Com_show_create_proc              | 0        |
    103 | Com_show_create_table             | 0        |
    104 | Com_show_create_trigger           | 0        |
    105 | Com_show_databases                | 4        |
    106 | Com_show_engine_logs              | 0        |
    107 | Com_show_engine_mutex             | 0        |
    108 | Com_show_engine_status            | 0        |
    109 | Com_show_events                   | 0        |
    110 | Com_show_errors                   | 0        |
    111 | Com_show_fields                   | 23       |
    112 | Com_show_function_status          | 0        |
    113 | Com_show_grants                   | 0        |
    114 | Com_show_keys                     | 0        |
    115 | Com_show_master_status            | 0        |
    116 | Com_show_new_master               | 0        |
    117 | Com_show_open_tables              | 0        |
    118 | Com_show_plugins                  | 0        |
    119 | Com_show_privileges               | 0        |
    120 | Com_show_procedure_status         | 0        |
    121 | Com_show_processlist              | 0        |
    122 | Com_show_profile                  | 0        |
    123 | Com_show_profiles                 | 0        |
    124 | Com_show_slave_hosts              | 0        |
    125 | Com_show_slave_status             | 0        |
    126 | Com_show_status                   | 23       |
    127 | Com_show_storage_engines          | 0        |
    128 | Com_show_table_status             | 0        |
    129 | Com_show_tables                   | 2        |
    130 | Com_show_triggers                 | 0        |
    131 | Com_show_variables                | 0        |
    132 | Com_show_warnings                 | 0        |
    133 | Com_slave_start                   | 0        |
    134 | Com_slave_stop                    | 0        |
    135 | Com_stmt_close                    | 0        |
    136 | Com_stmt_execute                  | 0        |
    137 | Com_stmt_fetch                    | 0        |
    138 | Com_stmt_prepare                  | 0        |
    139 | Com_stmt_reprepare                | 0        |
    140 | Com_stmt_reset                    | 0        |
    141 | Com_stmt_send_long_data           | 0        |
    142 | Com_truncate                      | 0        |
    143 | Com_uninstall_plugin              | 0        |
    144 | Com_unlock_tables                 | 0        |
    145 | Com_update                        | 0        |
    146 | Com_update_multi                  | 0        |
    147 | Com_xa_commit                     | 0        |
    148 | Com_xa_end                        | 0        |
    149 | Com_xa_prepare                    | 0        |
    150 | Com_xa_recover                    | 0        |
    151 | Com_xa_rollback                   | 0        |
    152 | Com_xa_start                      | 0        |
    153 | Compression                       | OFF      |
    154 | Connections                       | 22       |
    155 | Created_tmp_disk_tables           | 0        |
    156 | Created_tmp_files                 | 5        |
    157 | Created_tmp_tables                | 14       |
    158 | Delayed_errors                    | 0        |
    159 | Delayed_insert_threads            | 0        |
    160 | Delayed_writes                    | 0        |
    161 | Flush_commands                    | 1        |
    162 | Handler_commit                    | 0        |
    163 | Handler_delete                    | 2        |
    164 | Handler_discover                  | 0        |
    165 | Handler_prepare                   | 0        |
    166 | Handler_read_first                | 80       |
    167 | Handler_read_key                  | 80       |
    168 | Handler_read_next                 | 126      |
    169 | Handler_read_prev                 | 14       |
    170 | Handler_read_rnd                  | 126      |
    171 | Handler_read_rnd_next             | 1190     |
    172 | Handler_rollback                  | 0        |
    173 | Handler_savepoint                 | 0        |
    174 | Handler_savepoint_rollback        | 0        |
    175 | Handler_update                    | 0        |
    176 | Handler_write                     | 70       |
    177 | Innodb_buffer_pool_pages_data     | 19       |
    178 | Innodb_buffer_pool_pages_dirty    | 0        |
    179 | Innodb_buffer_pool_pages_flushed  | 1        |
    180 | Innodb_buffer_pool_pages_free     | 493      |
    181 | Innodb_buffer_pool_pages_misc     | 0        |
    182 | Innodb_buffer_pool_pages_total    | 512      |
    183 | Innodb_buffer_pool_read_ahead_rnd | 1        |
    184 | Innodb_buffer_pool_read_ahead_seq | 0        |
    185 | Innodb_buffer_pool_read_requests  | 84       |
    186 | Innodb_buffer_pool_reads          | 12       |
    187 | Innodb_buffer_pool_wait_free      | 0        |
    188 | Innodb_buffer_pool_write_requests | 1        |
    189 | Innodb_data_fsyncs                | 7        |
    190 | Innodb_data_pending_fsyncs        | 0        |
    191 | Innodb_data_pending_reads         | 0        |
    192 | Innodb_data_pending_writes        | 0        |
    193 | Innodb_data_read                  | 2494464  |
    194 | Innodb_data_reads                 | 25       |
    195 | Innodb_data_writes                | 7        |
    196 | Innodb_data_written               | 35328    |
    197 | Innodb_dblwr_pages_written        | 1        |
    198 | Innodb_dblwr_writes               | 1        |
    199 | Innodb_log_waits                  | 0        |
    200 | Innodb_log_write_requests         | 0        |
    201 | Innodb_log_writes                 | 2        |
    202 | Innodb_os_log_fsyncs              | 5        |
    203 | Innodb_os_log_pending_fsyncs      | 0        |
    204 | Innodb_os_log_pending_writes      | 0        |
    205 | Innodb_os_log_written             | 1024     |
    206 | Innodb_page_size                  | 16384    |
    207 | Innodb_pages_created              | 0        |
    208 | Innodb_pages_read                 | 19       |
    209 | Innodb_pages_written              | 1        |
    210 | Innodb_row_lock_current_waits     | 0        |
    211 | Innodb_row_lock_time              | 0        |
    212 | Innodb_row_lock_time_avg          | 0        |
    213 | Innodb_row_lock_time_max          | 0        |
    214 | Innodb_row_lock_waits             | 0        |
    215 | Innodb_rows_deleted               | 0        |
    216 | Innodb_rows_inserted              | 0        |
    217 | Innodb_rows_read                  | 0        |
    218 | Innodb_rows_updated               | 0        |
    219 | Key_blocks_not_flushed            | 0        |
    220 | Key_blocks_unused                 | 6681     |
    221 | Key_blocks_used                   | 13       |
    222 | Key_read_requests                 | 284      |
    223 | Key_reads                         | 13       |
    224 | Key_write_requests                | 4        |
    225 | Key_writes                        | 2        |
    226 | Last_query_cost                   | 0.000000 |
    227 | Max_used_connections              | 1        |
    228 | Not_flushed_delayed_rows          | 0        |
    229 | Open_files                        | 68       |
    230 | Open_streams                      | 0        |
    231 | Open_table_definitions            | 34       |
    232 | Open_tables                       | 34       |
    233 | Opened_files                      | 129      |
    234 | Opened_table_definitions          | 34       |
    235 | Opened_tables                     | 41       |
    236 | Prepared_stmt_count               | 0        |
    237 | Qcache_free_blocks                | 0        |
    238 | Qcache_free_memory                | 0        |
    239 | Qcache_hits                       | 0        |
    240 | Qcache_inserts                    | 0        |
    241 | Qcache_lowmem_prunes              | 0        |
    242 | Qcache_not_cached                 | 0        |
    243 | Qcache_queries_in_cache           | 0        |
    244 | Qcache_total_blocks               | 0        |
    245 | Queries                           | 235      |
    246 | Questions                         | 235      |
    247 | Rpl_status                        | NULL     |
    248 | Select_full_join                  | 0        |
    249 | Select_full_range_join            | 0        |
    250 | Select_range                      | 0        |
    251 | Select_range_check                | 0        |
    252 | Select_scan                       | 16       |
    253 | Slave_open_temp_tables            | 0        |
    254 | Slave_retried_transactions        | 0        |
    255 | Slave_running                     | OFF      |
    256 | Slow_launch_threads               | 0        |
    257 | Slow_queries                      | 0        |
    258 | Sort_merge_passes                 | 0        |
    259 | Sort_range                        | 7        |
    260 | Sort_rows                         | 126      |
    261 | Sort_scan                         | 7        |
    262 | Ssl_accept_renegotiates           | 0        |
    263 | Ssl_accepts                       | 0        |
    264 | Ssl_callback_cache_hits           | 0        |
    265 | Ssl_cipher                        |          |
    266 | Ssl_cipher_list                   |          |
    267 | Ssl_client_connects               | 0        |
    268 | Ssl_connect_renegotiates          | 0        |
    269 | Ssl_ctx_verify_depth              | 0        |
    270 | Ssl_ctx_verify_mode               | 0        |
    271 | Ssl_default_timeout               | 0        |
    272 | Ssl_finished_accepts              | 0        |
    273 | Ssl_finished_connects             | 0        |
    274 | Ssl_session_cache_hits            | 0        |
    275 | Ssl_session_cache_misses          | 0        |
    276 | Ssl_session_cache_mode            | NONE     |
    277 | Ssl_session_cache_overflows       | 0        |
    278 | Ssl_session_cache_size            | 0        |
    279 | Ssl_session_cache_timeouts        | 0        |
    280 | Ssl_sessions_reused               | 0        |
    281 | Ssl_used_session_cache_entries    | 0        |
    282 | Ssl_verify_depth                  | 0        |
    283 | Ssl_verify_mode                   | 0        |
    284 | Ssl_version                       |          |
    285 | Table_locks_immediate             | 186      |
    286 | Table_locks_waited                | 0        |
    287 | Tc_log_max_pages_used             | 0        |
    288 | Tc_log_page_size                  | 0        |
    289 | Tc_log_page_waits                 | 0        |
    290 | Threads_cached                    | 0        |
    291 | Threads_connected                 | 1        |
    292 | Threads_created                   | 21       |
    293 | Threads_running                   | 1        |
    294 | Uptime                            | 232802   |
    295 | Uptime_since_flush_status         | 232802   |
    296 +-----------------------------------+----------+
    297 [root@yinzhengjie ~]# 
    输出mysq的各状态变量及数值,相当于执行“mysql> show global status”

    6.flush-hosts

    1 [root@yinzhengjie ~]# mysqladmin flush-hosts    #清空主机相关的缓存:DNS解析缓存,此前因为连接错误次数过多而被拒绝访问mysqld的主机列表
    2 [root@yinzhengjie ~]# 

    7. flush-logs

    1 [root@yinzhengjie ~]# mysqladmin flush-logs     #日志滚动,主要是二进制日志和中继日志
    2 [root@yinzhengjie ~]# 

    8.refresh

    1 [root@yinzhengjie ~]# mysqladmin refresh    #相当于同时使用flush-logs和flush-hosts
    2 [root@yinzhengjie ~]# 

    9.flush-privileges

    1 [root@yinzhengjie ~]# mysqladmin flush-privileges  #通知服务器重读授权表
    2 [root@yinzhengjie ~]# 

    10.reload

    1 [root@yinzhengjie ~]# mysqladmin reload    #重载授权表,相当于flush-privileges
    2 [root@yinzhengjie ~]# 

    11.flush-status

    1 [root@yinzhengjie ~]# mysqladmin  flush-status  #重置状态变量的值
    2 [root@yinzhengjie ~]# 

    12.flush-tables

    1 [root@yinzhengjie ~]# mysqladmin  flush-tables  #关闭当前打开的表文件句柄
    2 [root@yinzhengjie ~]# 

    13.flush-threads

    1 [root@yinzhengjie ~]# mysqladmin  flush-threads  #清空线程缓存
    2 [root@yinzhengjie ~]# 

    14.kill

    1 [root@yinzhengjie ~]# mysqladmin  kill       #需要输入线程ID哟
    2 mysqladmin: Too few arguments to 'kill'
    3 [root@yinzhengjie ~]# 
    15.processlist
    1 [root@yinzhengjie ~]# mysqladmin  processlist  #线程列表
    2 +----+------+-----------+----+---------+------+-------+------------------+
    3 | Id | User | Host      | db | Command | Time | State | Info             |
    4 +----+------+-----------+----+---------+------+-------+------------------+
    5 | 34 | root | localhost |    | Query   | 0    |       | show processlist |
    6 +----+------+-----------+----+---------+------+-------+------------------+
    7 [root@yinzhengjie ~]# 

    16.password

     1 [root@yinzhengjie ~]# mysqladmin -u root -h localhost password 'yinzhengjie' -p
     2 Enter password:   -------->注意,由于我的数据库一开始是没有设置密码的,因此我这里是第一次给我的数据库设置密码,这里要求我们输入以前的密码我们直接回车即可。
     3 [root@yinzhengjie ~]#
     4 [root@yinzhengjie ~]# mysqladmin -u root -h localhost -pyinzhengjie flush-privileges  #需要刷新一下授权。
     5 [root@yinzhengjie ~]# 
     6 [root@yinzhengjie ~]# mysql -pyinzhengjie     #验证是否可用正常登陆。
     7 Welcome to the MySQL monitor.  Commands end with ; or g.
     8 Your MySQL connection id is 39
     9 Server version: 5.1.73 Source distribution
    10 
    11 Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    12 
    13 Oracle is a registered trademark of Oracle Corporation and/or its
    14 affiliates. Other names may be trademarks of their respective
    15 owners.
    16 
    17 Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    18 
    19 mysql> 

    17.ping

    1 [root@yinzhengjie ~]# mysqladmin -pyinzhengjie ping    #判断MySQL是否在线。
    2 mysqld is alive
    3 [root@yinzhengjie ~]# 

    18.shutdown

    1 [root@yinzhengjie ~]# mysqladmin -pyinzhengjie  shutdown  #关闭mysqld进程
    2 [root@yinzhengjie ~]# lsof -i:3306
    3 [root@yinzhengjie ~]# 

    19.start-slave

    1 [root@yinzhengjie ~]# 
    2 [root@yinzhengjie ~]# mysqladmin -pyinzhengjie start-slave   #启动从服务器进程

    20.stop-slave

    1 [root@yinzhengjie ~]# 
    2 [root@yinzhengjie ~]# mysqladmin -pyinzhengjie stop-slave  #关闭从服务器进程

    21.variables

      1 [root@yinzhengjie ~]# mysqladmin -pyinzhengjie  variables
      2 +-----------------------------------------+-------------------------------------------------------------------------------------------+
      3 | Variable_name                           | Value                                                                                     |
      4 +-----------------------------------------+-------------------------------------------------------------------------------------------+
      5 | auto_increment_increment                | 1                                                                                         |
      6 | auto_increment_offset                   | 1                                                                                         |
      7 | autocommit                              | ON                                                                                        |
      8 | automatic_sp_privileges                 | ON                                                                                        |
      9 | back_log                                | 50                                                                                        |
     10 | basedir                                 | /usr/                                                                                     |
     11 | big_tables                              | OFF                                                                                       |
     12 | binlog_cache_size                       | 32768                                                                                     |
     13 | binlog_direct_non_transactional_updates | OFF                                                                                       |
     14 | binlog_format                           | STATEMENT                                                                                 |
     15 | bulk_insert_buffer_size                 | 8388608                                                                                   |
     16 | character_set_client                    | latin1                                                                                    |
     17 | character_set_connection                | latin1                                                                                    |
     18 | character_set_database                  | latin1                                                                                    |
     19 | character_set_filesystem                | binary                                                                                    |
     20 | character_set_results                   | latin1                                                                                    |
     21 | character_set_server                    | latin1                                                                                    |
     22 | character_set_system                    | utf8                                                                                      |
     23 | character_sets_dir                      | /usr/share/mysql/charsets/                                                                |
     24 | collation_connection                    | latin1_swedish_ci                                                                         |
     25 | collation_database                      | latin1_swedish_ci                                                                         |
     26 | collation_server                        | latin1_swedish_ci                                                                         |
     27 | completion_type                         | 0                                                                                         |
     28 | concurrent_insert                       | 1                                                                                         |
     29 | connect_timeout                         | 10                                                                                        |
     30 | datadir                                 | /var/lib/mysql/                                                                           |
     31 | date_format                             | %Y-%m-%d                                                                                  |
     32 | datetime_format                         | %Y-%m-%d %H:%i:%s                                                                         |
     33 | default_week_format                     | 0                                                                                         |
     34 | delay_key_write                         | ON                                                                                        |
     35 | delayed_insert_limit                    | 100                                                                                       |
     36 | delayed_insert_timeout                  | 300                                                                                       |
     37 | delayed_queue_size                      | 1000                                                                                      |
     38 | div_precision_increment                 | 4                                                                                         |
     39 | engine_condition_pushdown               | ON                                                                                        |
     40 | error_count                             | 0                                                                                         |
     41 | event_scheduler                         | OFF                                                                                       |
     42 | expire_logs_days                        | 0                                                                                         |
     43 | flush                                   | OFF                                                                                       |
     44 | flush_time                              | 0                                                                                         |
     45 | foreign_key_checks                      | ON                                                                                        |
     46 | ft_boolean_syntax                       | + -><()~*:""&|                                                                            |
     47 | ft_max_word_len                         | 84                                                                                        |
     48 | ft_min_word_len                         | 4                                                                                         |
     49 | ft_query_expansion_limit                | 20                                                                                        |
     50 | ft_stopword_file                        | (built-in)                                                                                |
     51 | general_log                             | OFF                                                                                       |
     52 | general_log_file                        | /var/run/mysqld/mysqld.log                                                                |
     53 | group_concat_max_len                    | 1024                                                                                      |
     54 | have_community_features                 | YES                                                                                       |
     55 | have_compress                           | YES                                                                                       |
     56 | have_crypt                              | YES                                                                                       |
     57 | have_csv                                | YES                                                                                       |
     58 | have_dynamic_loading                    | YES                                                                                       |
     59 | have_geometry                           | YES                                                                                       |
     60 | have_innodb                             | YES                                                                                       |
     61 | have_ndbcluster                         | NO                                                                                        |
     62 | have_openssl                            | DISABLED                                                                                  |
     63 | have_partitioning                       | YES                                                                                       |
     64 | have_query_cache                        | YES                                                                                       |
     65 | have_rtree_keys                         | YES                                                                                       |
     66 | have_ssl                                | DISABLED                                                                                  |
     67 | have_symlink                            | DISABLED                                                                                  |
     68 | hostname                                | yinzhengjie                                                                               |
     69 | identity                                | 0                                                                                         |
     70 | ignore_builtin_innodb                   | OFF                                                                                       |
     71 | init_connect                            |                                                                                           |
     72 | init_file                               |                                                                                           |
     73 | init_slave                              |                                                                                           |
     74 | innodb_adaptive_hash_index              | ON                                                                                        |
     75 | innodb_additional_mem_pool_size         | 1048576                                                                                   |
     76 | innodb_autoextend_increment             | 8                                                                                         |
     77 | innodb_autoinc_lock_mode                | 1                                                                                         |
     78 | innodb_buffer_pool_size                 | 8388608                                                                                   |
     79 | innodb_checksums                        | ON                                                                                        |
     80 | innodb_commit_concurrency               | 0                                                                                         |
     81 | innodb_concurrency_tickets              | 500                                                                                       |
     82 | innodb_data_file_path                   | ibdata1:10M:autoextend                                                                    |
     83 | innodb_data_home_dir                    |                                                                                           |
     84 | innodb_doublewrite                      | ON                                                                                        |
     85 | innodb_fast_shutdown                    | 1                                                                                         |
     86 | innodb_file_io_threads                  | 4                                                                                         |
     87 | innodb_file_per_table                   | OFF                                                                                       |
     88 | innodb_flush_log_at_trx_commit          | 1                                                                                         |
     89 | innodb_flush_method                     |                                                                                           |
     90 | innodb_force_recovery                   | 0                                                                                         |
     91 | innodb_lock_wait_timeout                | 50                                                                                        |
     92 | innodb_locks_unsafe_for_binlog          | OFF                                                                                       |
     93 | innodb_log_buffer_size                  | 1048576                                                                                   |
     94 | innodb_log_file_size                    | 5242880                                                                                   |
     95 | innodb_log_files_in_group               | 2                                                                                         |
     96 | innodb_log_group_home_dir               | ./                                                                                        |
     97 | innodb_max_dirty_pages_pct              | 90                                                                                        |
     98 | innodb_max_purge_lag                    | 0                                                                                         |
     99 | innodb_mirrored_log_groups              | 1                                                                                         |
    100 | innodb_open_files                       | 300                                                                                       |
    101 | innodb_rollback_on_timeout              | OFF                                                                                       |
    102 | innodb_stats_method                     | nulls_equal                                                                               |
    103 | innodb_stats_on_metadata                | ON                                                                                        |
    104 | innodb_support_xa                       | ON                                                                                        |
    105 | innodb_sync_spin_loops                  | 20                                                                                        |
    106 | innodb_table_locks                      | ON                                                                                        |
    107 | innodb_thread_concurrency               | 8                                                                                         |
    108 | innodb_thread_sleep_delay               | 10000                                                                                     |
    109 | innodb_use_legacy_cardinality_algorithm | ON                                                                                        |
    110 | insert_id                               | 0                                                                                         |
    111 | interactive_timeout                     | 28800                                                                                     |
    112 | join_buffer_size                        | 131072                                                                                    |
    113 | keep_files_on_create                    | OFF                                                                                       |
    114 | key_buffer_size                         | 8384512                                                                                   |
    115 | key_cache_age_threshold                 | 300                                                                                       |
    116 | key_cache_block_size                    | 1024                                                                                      |
    117 | key_cache_division_limit                | 100                                                                                       |
    118 | language                                | /usr/share/mysql/english/                                                                 |
    119 | large_files_support                     | ON                                                                                        |
    120 | large_page_size                         | 0                                                                                         |
    121 | large_pages                             | OFF                                                                                       |
    122 | last_insert_id                          | 0                                                                                         |
    123 | lc_time_names                           | en_US                                                                                     |
    124 | license                                 | GPL                                                                                       |
    125 | local_infile                            | ON                                                                                        |
    126 | locked_in_memory                        | OFF                                                                                       |
    127 | log                                     | OFF                                                                                       |
    128 | log_bin                                 | OFF                                                                                       |
    129 | log_bin_trust_function_creators         | OFF                                                                                       |
    130 | log_bin_trust_routine_creators          | OFF                                                                                       |
    131 | log_error                               | /var/log/mysqld.log                                                                       |
    132 | log_output                              | FILE                                                                                      |
    133 | log_queries_not_using_indexes           | OFF                                                                                       |
    134 | log_slave_updates                       | OFF                                                                                       |
    135 | log_slow_queries                        | OFF                                                                                       |
    136 | log_warnings                            | 1                                                                                         |
    137 | long_query_time                         | 10.000000                                                                                 |
    138 | low_priority_updates                    | OFF                                                                                       |
    139 | lower_case_file_system                  | OFF                                                                                       |
    140 | lower_case_table_names                  | 0                                                                                         |
    141 | max_allowed_packet                      | 1048576                                                                                   |
    142 | max_binlog_cache_size                   | 18446744073709547520                                                                      |
    143 | max_binlog_size                         | 1073741824                                                                                |
    144 | max_connect_errors                      | 10                                                                                        |
    145 | max_connections                         | 151                                                                                       |
    146 | max_delayed_threads                     | 20                                                                                        |
    147 | max_error_count                         | 64                                                                                        |
    148 | max_heap_table_size                     | 16777216                                                                                  |
    149 | max_insert_delayed_threads              | 20                                                                                        |
    150 | max_join_size                           | 18446744073709551615                                                                      |
    151 | max_length_for_sort_data                | 1024                                                                                      |
    152 | max_long_data_size                      | 1048576                                                                                   |
    153 | max_prepared_stmt_count                 | 16382                                                                                     |
    154 | max_relay_log_size                      | 0                                                                                         |
    155 | max_seeks_for_key                       | 18446744073709551615                                                                      |
    156 | max_sort_length                         | 1024                                                                                      |
    157 | max_sp_recursion_depth                  | 0                                                                                         |
    158 | max_tmp_tables                          | 32                                                                                        |
    159 | max_user_connections                    | 0                                                                                         |
    160 | max_write_lock_count                    | 18446744073709551615                                                                      |
    161 | min_examined_row_limit                  | 0                                                                                         |
    162 | multi_range_count                       | 256                                                                                       |
    163 | myisam_data_pointer_size                | 6                                                                                         |
    164 | myisam_max_sort_file_size               | 9223372036853727232                                                                       |
    165 | myisam_mmap_size                        | 18446744073709551615                                                                      |
    166 | myisam_recover_options                  | OFF                                                                                       |
    167 | myisam_repair_threads                   | 1                                                                                         |
    168 | myisam_sort_buffer_size                 | 8388608                                                                                   |
    169 | myisam_stats_method                     | nulls_unequal                                                                             |
    170 | myisam_use_mmap                         | OFF                                                                                       |
    171 | net_buffer_length                       | 16384                                                                                     |
    172 | net_read_timeout                        | 30                                                                                        |
    173 | net_retry_count                         | 10                                                                                        |
    174 | net_write_timeout                       | 60                                                                                        |
    175 | new                                     | OFF                                                                                       |
    176 | old                                     | OFF                                                                                       |
    177 | old_alter_table                         | OFF                                                                                       |
    178 | old_passwords                           | OFF                                                                                       |
    179 | open_files_limit                        | 1024                                                                                      |
    180 | optimizer_prune_level                   | 1                                                                                         |
    181 | optimizer_search_depth                  | 62                                                                                        |
    182 | optimizer_switch                        | index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on |
    183 | pid_file                                | /var/run/mysqld/mysqld.pid                                                                |
    184 | plugin_dir                              | /usr/lib64/mysql/plugin                                                                   |
    185 | port                                    | 3306                                                                                      |
    186 | preload_buffer_size                     | 32768                                                                                     |
    187 | profiling                               | OFF                                                                                       |
    188 | profiling_history_size                  | 15                                                                                        |
    189 | protocol_version                        | 10                                                                                        |
    190 | pseudo_thread_id                        | 0                                                                                         |
    191 | query_alloc_block_size                  | 8192                                                                                      |
    192 | query_cache_limit                       | 1048576                                                                                   |
    193 | query_cache_min_res_unit                | 4096                                                                                      |
    194 | query_cache_size                        | 0                                                                                         |
    195 | query_cache_type                        | ON                                                                                        |
    196 | query_cache_wlock_invalidate            | OFF                                                                                       |
    197 | query_prealloc_size                     | 8192                                                                                      |
    198 | rand_seed1                              |                                                                                           |
    199 | rand_seed2                              |                                                                                           |
    200 | range_alloc_block_size                  | 4096                                                                                      |
    201 | read_buffer_size                        | 131072                                                                                    |
    202 | read_only                               | OFF                                                                                       |
    203 | read_rnd_buffer_size                    | 262144                                                                                    |
    204 | relay_log                               |                                                                                           |
    205 | relay_log_index                         |                                                                                           |
    206 | relay_log_info_file                     | relay-log.info                                                                            |
    207 | relay_log_purge                         | ON                                                                                        |
    208 | relay_log_space_limit                   | 0                                                                                         |
    209 | report_host                             |                                                                                           |
    210 | report_password                         |                                                                                           |
    211 | report_port                             | 3306                                                                                      |
    212 | report_user                             |                                                                                           |
    213 | rpl_recovery_rank                       | 0                                                                                         |
    214 | secure_auth                             | OFF                                                                                       |
    215 | secure_file_priv                        |                                                                                           |
    216 | server_id                               | 0                                                                                         |
    217 | skip_external_locking                   | ON                                                                                        |
    218 | skip_name_resolve                       | OFF                                                                                       |
    219 | skip_networking                         | OFF                                                                                       |
    220 | skip_show_database                      | OFF                                                                                       |
    221 | slave_compressed_protocol               | OFF                                                                                       |
    222 | slave_exec_mode                         | STRICT                                                                                    |
    223 | slave_load_tmpdir                       | /tmp                                                                                      |
    224 | slave_max_allowed_packet                | 1073741824                                                                                |
    225 | slave_net_timeout                       | 3600                                                                                      |
    226 | slave_skip_errors                       | OFF                                                                                       |
    227 | slave_transaction_retries               | 10                                                                                        |
    228 | slow_launch_time                        | 2                                                                                         |
    229 | slow_query_log                          | OFF                                                                                       |
    230 | slow_query_log_file                     | /var/run/mysqld/mysqld-slow.log                                                           |
    231 | socket                                  | /var/lib/mysql/mysql.sock                                                                 |
    232 | sort_buffer_size                        | 2097144                                                                                   |
    233 | sql_auto_is_null                        | ON                                                                                        |
    234 | sql_big_selects                         | ON                                                                                        |
    235 | sql_big_tables                          | OFF                                                                                       |
    236 | sql_buffer_result                       | OFF                                                                                       |
    237 | sql_log_bin                             | ON                                                                                        |
    238 | sql_log_off                             | OFF                                                                                       |
    239 | sql_log_update                          | ON                                                                                        |
    240 | sql_low_priority_updates                | OFF                                                                                       |
    241 | sql_max_join_size                       | 18446744073709551615                                                                      |
    242 | sql_mode                                |                                                                                           |
    243 | sql_notes                               | ON                                                                                        |
    244 | sql_quote_show_create                   | ON                                                                                        |
    245 | sql_safe_updates                        | OFF                                                                                       |
    246 | sql_select_limit                        | 18446744073709551615                                                                      |
    247 | sql_slave_skip_counter                  |                                                                                           |
    248 | sql_warnings                            | OFF                                                                                       |
    249 | ssl_ca                                  |                                                                                           |
    250 | ssl_capath                              |                                                                                           |
    251 | ssl_cert                                |                                                                                           |
    252 | ssl_cipher                              |                                                                                           |
    253 | ssl_key                                 |                                                                                           |
    254 | storage_engine                          | MyISAM                                                                                    |
    255 | sync_binlog                             | 0                                                                                         |
    256 | sync_frm                                | ON                                                                                        |
    257 | system_time_zone                        | PST                                                                                       |
    258 | table_definition_cache                  | 256                                                                                       |
    259 | table_lock_wait_timeout                 | 50                                                                                        |
    260 | table_open_cache                        | 64                                                                                        |
    261 | table_type                              | MyISAM                                                                                    |
    262 | thread_cache_size                       | 0                                                                                         |
    263 | thread_handling                         | one-thread-per-connection                                                                 |
    264 | thread_stack                            | 262144                                                                                    |
    265 | time_format                             | %H:%i:%s                                                                                  |
    266 | time_zone                               | SYSTEM                                                                                    |
    267 | timed_mutexes                           | OFF                                                                                       |
    268 | timestamp                               | 1510669162                                                                                |
    269 | tmp_table_size                          | 16777216                                                                                  |
    270 | tmpdir                                  | /tmp                                                                                      |
    271 | transaction_alloc_block_size            | 8192                                                                                      |
    272 | transaction_prealloc_size               | 4096                                                                                      |
    273 | tx_isolation                            | REPEATABLE-READ                                                                           |
    274 | unique_checks                           | ON                                                                                        |
    275 | updatable_views_with_limit              | YES                                                                                       |
    276 | version                                 | 5.1.73                                                                                    |
    277 | version_comment                         | Source distribution                                                                       |
    278 | version_compile_machine                 | x86_64                                                                                    |
    279 | version_compile_os                      | redhat-linux-gnu                                                                          |
    280 | wait_timeout                            | 28800                                                                                     |
    281 | warning_count                           | 0                                                                                         |
    282 +-----------------------------------------+-------------------------------------------------------------------------------------------+
    283 [root@yinzhengjie ~]# 
    variables:显示mysql的各服务器进程

     六.GUI客户端工具

    1>.Navicat for mysql
    2>.SQLyog
    3>.MySQL Front
    4>.phpMyAdmin
    5>.MySQL Query Browser
    6>.MySQL Administrator
    7>.MySQL Workbench

     

  • 相关阅读:
    Java面试题总结之JDBC 和Hibernate
    Java面试题总结之数据库与SQL语句
    Java面试题总结之OOA/D,UML,和XML
    Java面试题总结之数据结构、算法和计算机基础(刘小牛和丝音的爱情故事1)...
    文件路径的引用问题(配置文件路径vue.config.js)
    vue-cli2引入Bootstrap和jQuery
    ES6常用语法总结
    vue-cli4引入jquery和bootstrap
    vue-router的两种模式(hash和history)及区别
    本地存储localStorage的用法总结
  • 原文地址:https://www.cnblogs.com/yinzhengjie/p/7834763.html
Copyright © 2020-2023  润新知