0

Today I noticed that suddenly, a number of views are created in my DB, most of these views deal with system performance. I am pretty sure I have not created these views, for all of then the DEFINER is
DEFINER=mysql.sys@localhost

Have I been a victim of any SQL injections, has anyone tempered with my DB OR is it that mistakenly someone has changed any configurations that has created these views?

if this is a config change, how can I undo the config change, if there is any other issue what could be the solution to this ?

Following are the View that were created.

host_summary
host_summary_by_file_io
host_summary_by_file_io_type
host_summary_by_stages
host_summary_by_statement_latency
host_summary_by_statement_type
innodb_buffer_stats_by_schema
innodb_buffer_stats_by_table
innodb_lock_waits
io_by_thread_by_latency
io_global_by_file_by_bytes
io_global_by_file_by_latency
io_global_by_wait_by_bytes
io_global_by_wait_by_latency
latest_file_io
memory_by_host_by_current_bytes
memory_by_thread_by_current_bytes
memory_by_user_by_current_bytes
memory_global_by_current_bytes
memory_global_total
metrics
processlist
ps_check_lost_instrumentation
schema_auto_increment_columns
schema_index_statistics
schema_object_overview
schema_redundant_indexes
schema_table_lock_waits
schema_table_statistics
schema_table_statistics_with_buffer
schema_tables_with_full_table_scans
schema_unused_indexes
session
session_ssl_status
statement_analysis
statements_with_errors_or_warnings
statements_with_full_table_scans
statements_with_runtimes_in_95th_percentile
statements_with_sorting
statements_with_temp_tables
user_summary
user_summary_by_file_io
user_summary_by_file_io_type
user_summary_by_stages
user_summary_by_statement_latency
user_summary_by_statement_type
version
wait_classes_global_by_avg_latency
wait_classes_global_by_latency
waits_by_host_by_latency
waits_by_user_by_latency
waits_global_by_latency
x$host_summary
x$host_summary_by_file_io
x$host_summary_by_file_io_type
x$host_summary_by_stages
x$host_summary_by_statement_latency
x$host_summary_by_statement_type
x$innodb_buffer_stats_by_schema
x$innodb_buffer_stats_by_table
x$innodb_lock_waits
x$io_by_thread_by_latency
x$io_global_by_file_by_bytes
x$io_global_by_file_by_latency
x$io_global_by_wait_by_bytes
x$io_global_by_wait_by_latency
x$latest_file_io
x$memory_by_host_by_current_bytes
x$memory_by_thread_by_current_bytes
x$memory_by_user_by_current_bytes
x$memory_global_by_current_bytes
x$memory_global_total
x$processlist
x$ps_digest_95th_percentile_by_avg_us
x$ps_digest_avg_latency_distribution
x$ps_schema_table_statistics_io
x$schema_flattened_keys
x$schema_index_statistics
x$schema_table_lock_waits
x$schema_table_statistics
x$schema_table_statistics_with_buffer
x$schema_tables_with_full_table_scans
x$session
x$statement_analysis
x$statements_with_errors_or_warnings
x$statements_with_full_table_scans
x$statements_with_runtimes_in_95th_percentile
x$statements_with_sorting
x$statements_with_temp_tables
x$user_summary
x$user_summary_by_file_io
x$user_summary_by_file_io_type
x$user_summary_by_stages
x$user_summary_by_statement_latency
x$user_summary_by_statement_type
x$wait_classes_global_by_avg_latency
x$wait_classes_global_by_latency
x$waits_by_host_by_latency
x$waits_by_user_by_latency
x$waits_global_by_latency

3 Answers3

0

No problem. Notice which databases those Views are in. They are in system dbs (probably sys, information_schema, performance_schema and maybe MySQL), not yours. And, yes, those are deliberately Views.

"suddenly" -- Did you recently upgrade to a new version of MySQL? There did not used to be any system-generated views.

Rick James
  • 135,179
  • 13
  • 127
  • 222
  • These Views have been created in my application DB and not in the system dbs...I have not performed any upgrade recently. – Vikas Mishra Mar 30 '21 at 08:08
  • @VikasMishra - Can you provide one of the views? Maybe we can (1) see if they exist on another machine and (2) see what they do. – Rick James Mar 30 '21 at 12:09
0

The presence of views in the sys schema are not evidence that you have been a victim of SQL injection or tampering.

These views are official and documented: https://dev.mysql.com/doc/refman/8.0/en/sys-schema.html

The sys schema was optional in MySQL 5.6. These views were developed by an engineering manager at MySQL. But in 5.6, you had to install them manually by running an SQL script downloaded from github (see https://github.com/mysql/mysql-sys).

In MySQL 5.7, the sys schema became part of the default installation. If you upgrade from MySQL 5.6 to 5.7, the sys schema would be installed, as well as alterations to some other tables and views in system schemas like mysql, information_schema, and performance_schema.

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
  • I have no problem with these views been present in the `sys` schema, but these views are created in my application DB...these views were not present a month back but suddenly they poped out of nowhere, I have not even done any upgrade on the DB. – Vikas Mishra Mar 30 '21 at 08:12
  • @VikasMishra - What version are you running? – Rick James Mar 30 '21 at 12:11
0

One of Our Developers had enabled performance monitoring, thus these views were created.