mysql command

  1. mysql创建数据库(utf8)

    1
    mysql> create database {dbname} default character set utf8 collate utf8_general_ci;
  2. 数据库授权

    1
    2
    mysql> grant all privileges on *.* to '{user}@'%' identified by '{password}' with grant option;
    mysql> flush privileges;
  3. 实时查看参数

    1
    [root@10 ~]# mysqladmin -uroot -S /mnt/data/mysql/3306/mysql.sock extended-status -r -i 1 |egrep 'Com_(select|insert|update|delete)'
  4. 数据库查看超时时间

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    mysql> show global variables like "%timeout%";
    +-----------------------------+----------+
    | Variable_name | Value |
    +-----------------------------+----------+
    | connect_timeout | 10 |
    | delayed_insert_timeout | 300 |
    | innodb_flush_log_at_timeout | 1 |
    | innodb_lock_wait_timeout | 50 |
    | innodb_rollback_on_timeout | OFF |
    | interactive_timeout | 300 |
    | lock_wait_timeout | 31536000 |
    | net_read_timeout | 30 |
    | net_write_timeout | 60 |
    | rpl_stop_slave_timeout | 31536000 |
    | slave_net_timeout | 3600 |
    | wait_timeout | 120 |
    +-----------------------------+----------+