1、AWS查询慢日志


select count(1) ,user_host from  mysql.slow_log group by user_host;
select count(*) from mysql.slow_log ;
 
 
 mysql> desc  mysql.slow_log ;
+----------------+---------------------+------+-----+-------------------+-----------------------------+
| Field          | Type                | Null | Key | Default           | Extra                       |
+----------------+---------------------+------+-----+-------------------+-----------------------------+
| start_time     | timestamp           | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| user_host      | mediumtext          | NO   |     | NULL              |                             |
| query_time     | time                | NO   |     | NULL              |                             |
| lock_time      | time                | NO   |     | NULL              |                             |
| rows_sent      | int(11)             | NO   |     | NULL              |                             |
| rows_examined  | int(11)             | NO   |     | NULL              |                             |
| db             | varchar(512)        | NO   |     | NULL              |                             |
| last_insert_id | int(11)             | NO   |     | NULL              |                             |
| insert_id      | int(11)             | NO   |     | NULL              |                             |
| server_id      | int(10) unsigned    | NO   |     | NULL              |                             |
| sql_text       | mediumtext          | NO   |     | NULL              |                             |
| thread_id      | bigint(21) unsigned | NO   |     | NULL              |                             |
+----------------+---------------------+------+-----+-------------------+-----------------------------+
mysql> select query_time,sql_text from  mysql.slow_log  order by query_time desc  limit 30; -- 慢查询安装时间排序
mysql> select query_time,sql_text from  mysql.slow_log where query_time >'00:00:10';    --查询大于10s的慢查询

2、AWS RDS修改root密码

 

详细信息--》修改--》修改数据库实例--》新建主密码---》继续--》立即应用 

注:修改主密码对业务无影响


3、AWS RDS授权另外一台ip访问

  •  安全组添加ip的白名单

  • 数据库中添加host的访问权限,user@'ip'