MySQL ERROR 1356 (HY000)
一、现象
使用备份软件备份报错
ERROR 1356 (HY000): View 'sys.host_summary' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
二、原因
检查sys表是否损坏
mysql> select if(isnull('performance_schema'.'accounts'.'HOST'),'background','performance_schema'.'accounts'.'HOST')
AS 'host',sum('stmt'.'total') AS 'statements','sys'.'format_time'(sum('stmt'.'total_latency')) AS 'statement_latency','sys'.'format_time'(ifnull((sum('stmt'.'total_latency') / nullif(sum('stmt'.'total'),0)),0))
AS 'statement_avg_latency',sum('stmt'.'full_scans') AS 'table_scans',sum('io'.'ios') AS 'file_ios','sys'.'format_time'(sum('io'.'io_latency')) AS 'file_io_latency',sum('performance_schema'.'accounts'.'CURRENT_CONNECTIONS')
AS 'current_connections',sum('performance_schema'.'accounts'.'TOTAL_CONNECTIONS') AS 'total_connections',count(distinct 'performance_schema'.'accounts'.'USER') AS 'unique_users','sys'.'format_bytes'(sum('mem'.'current_allocated'))
AS 'current_memory','sys'.'format_bytes'(sum('mem'.'total_allocated')) AS 'total_memory_al
5285
located' from
((('performance_schema'.'accounts' join
'sys'.'x$host_summary_by_statement_latency' 'stmt' on(('performance_schema'.'accounts'.'HOST' = 'stmt'.'host')))
join 'sys'.'x$host_summary_by_file_io' 'io' on(('performance_schema'.'accounts'.'HOST' = 'io'.'host')))
join 'sys'.'x$memory_by_host_by_current_bytes'
'mem' on(('performance_schema'.'accounts'.'HOST' = 'mem'.'host')))
group by if(isnull('performance_schema'.'accounts'.'HOST'),'background','performance_schema'.'accounts'.'HOST');
returns
ERROR 1305 (42000): FUNCTION sys.format_time does not exist
三、解决方法
如果主从库都有此问题,先从从库执行,再执行主库,mysql_upgrade不会使gtid变化,但是drop database 命令会使gtid变化,所以我们要关闭掉基于会话的sql_log_bin。
- STOP SLAVE;
- SET SQL_LOG_BIN=0;
- DROP DATABASE sys;
- SET SQL_LOG_BIN=1;
- Run mysql_upgrade
- START SLAVE;
- MySQL ERROR 1356 (HY000)
- mysql error :ERROR 1005 (HY000): Can't create table xxx
- mysql ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.s
- Mysql ERROR 145 (HY000)
- MYSQL ERROR 1862 (HY000): Your password has expired.
- linux下mysql ERROR 2002 (HY000)错误解决方法 Can't connect to local MySQL server through socket
- MySQL ERROR 1025(HY000): Error on rename of ...
- centos6.3 mysql ERROR 2002 (HY000)
- Mysql ERROR 1017 (HY000): Can't find file: './db/table.frm' (errno: 13)
- MySQL ERROR 1033 (HY000): Incorrect information in file. 处理一例
- mysql error 1130 hy000:Host'localhost'解决方案
- MYSQL ERROR 1130 (HY000) 的错误解决方案
- MYSQL ERROR 1862 (HY000): Your password has expired.
- mysql error 1130 hy000:Host 'localhost' is not allowed to connect to this mysql server 解决方案
- mysql error 1130 hy000:Host'localhost'解决方案
- 解决mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- mysql error: ERROR 2006 (HY000) at line 149351: MySQL server has gone away
- Mysql Error:ERROR 1130 (HY000): Host '${url}'解决方案
- mysql ERROR 1025 (HY000): Error on rename of
- mac 下的mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock