show variables like 'socket%';

mysql 运维用到的命令

通过socket 进行连接

mysql 运维用到的命令

 

  select user,host,authentication_string from user;

 mysql 运维用到的命令

 

 \s

mysql 运维用到的命令

开多个实例配置:

mysql 运维用到的命令

 mysql 运维用到的命令

 mysql 运维用到的命令

慢查询存入到数据表:   

mysql 运维用到的命令

 开启存储引擎:

mysql 运维用到的命令

 

  mysql 运维用到的命令

 

 禁用:

mysql 运维用到的命令

 

 mysql 运维用到的命令

 

 导入数据:

mysql 运维用到的命令

 int

mysql 运维用到的命令

 mysql 运维用到的命令

 mysql 运维用到的命令

字符串:

mysql 运维用到的命令

 获取随机数:

select floor(1+rand()*99);

重复某个字符多少次

select repeat('a',floor(1+rand()*127));

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 只修改后加入的,现有的不会修改:

mysql 运维用到的命令

 修改表的字符集:

mysql 运维用到的命令

 

 mysql 运维用到的命令

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 

 查找不是InnoDB的表:

select table_schema,table_name,`engine`, sys.format_bytes(data_length) as data_size from TABLES
where `engine` <> 'InnoDB'
and table_schema not in ('mysql','performance_schema','information_schema');f分区表

 分区表:

 

mysql 运维用到的命令

 计算表中每行数据的平均大小:

mysql 运维用到的命令

 mysql 运维用到的命令

 统计表中的列编码格式utf8

select 
   CONCAT(TABLE_SCHEMA,'.',TABLE_NAME) as Name,
	 character_set_name,
	 GROUP_CONCAT(COLUMN_NAME SEPARATOR ' : ') as COLUMN_LIST

from information_schema.COLUMNS
where
data_type in ('varchar','longtext','text','mediumtext','char')
and character_set_name <> 'utf8mb4'
and table_schema not in('mysql','`performance_schema`','information_schema','sys')
group by NAME,character_set_name;

  mysql 运维用到的命令

 

 mysql 运维用到的命令

 

  mysql 运维用到的命令

 

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 

比较不错的 sql:

mysql 运维用到的命令

自动添加行号:

mysql 运维用到的命令

 

 mysql 运维用到的命令

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 

 mysql 运维用到的命令

 mysql 运维用到的命令

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

相关文章:

  • 2021-08-21
  • 2022-02-14
  • 2021-11-01
  • 2022-03-09
  • 2022-12-23
猜你喜欢
  • 2021-12-06
  • 2021-11-22
  • 2021-12-06
  • 2023-03-14
  • 2021-05-08
  • 2021-12-09
相关资源
相似解决方案