免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 17272 | 回复: 6
打印 上一主题 下一主题

【已解决】关于mysql。performance_schema表的开启的问题。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-09 11:26 |只看该作者 |倒序浏览
本帖最后由 cenalulu 于 2013-04-09 14:57 编辑

按照官方文档的快速开启的方法我在配置文件my.cnf中指定了performance_schema的参数,结果无法启动程序。
日志显示不支持该启动参数,官方文档中说是因为编译的时候没有开启performance_schema的参数。
通过查看数据库环境变量show variables like 'performance_schema' ,返回结果empty。 但是查看数据库确莫名其妙的有| performance_schema | 库。
查看mysql版本:
+--------------+
| version()    |
+--------------+
| 5.5.3-m3-log |
+--------------+
5.5以上支持该库。请问高手,该如何启动该库?还有这个本来没有开启performanc_schema,这库怎么出来的如何解释?

论坛徽章:
0
2 [报告]
发表于 2013-04-09 14:53 |只看该作者
问题已经得到解决,看官方文档给出的解释是在编译的过程中没有开启相应的performance_schema引擎,通过查看编译参数发现确实没有开启。于是通过重新编译安装,先已得到支持。lol

论坛徽章:
0
3 [报告]
发表于 2013-04-09 16:52 |只看该作者
@onlinekof2001
嗯, 编译安装可能禁用了此部分,但二进制安装,默认是有performance_schema库, 选择项是关闭的。
因为打开后,对性能有一定的消耗。

论坛徽章:
0
4 [报告]
发表于 2013-04-10 13:35 |只看该作者
回复 3# RogerZhuo

我今天发现实际上打开performance_schema选项后,还是没能很好的使用。

情况如下。我想尝试查看p_s库中的表内容,但得到的反馈均是:
SELECT command denied to user 'root'@'localhost' for table 'setup_timers'

root用户怎么会没有权限能?还有一个比较奇怪的是,这个p_s库并不是自动生成的,而是我通过手动执行mysql_upgrade才生成相应的库和表。这到底是什么原理?麻烦各位有研究过的给个解释。谢谢!

论坛徽章:
8
综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年纪念徽章
日期:2013-10-24 15:41:34酉鸡
日期:2013-10-19 10:17:1315-16赛季CBA联赛之北京
日期:2017-03-06 15:12:44
5 [报告]
发表于 2013-04-10 13:37 |只看该作者
RogerZhuo 发表于 2013-04-09 16:52
@onlinekof2001
嗯, 编译安装可能禁用了此部分,但二进制安装,默认是有performance_schema库, 选择项是 ...



论坛徽章:
0
6 [报告]
发表于 2013-04-10 15:48 |只看该作者
回复 4# onlinekof2001

1)你的root@localhost没查询权限问题,执行一下show grants for 'root'@'localhost'

2)第一次看错你为MySQL5.5.30了, p_s是5.5.3就有的,不过,有可能如你所说的,在MySQL5.5.3时默认是没相关的。

3)MySQL5.5.20等,这安装后,肯定是有p_s库的。之前从5.1到5.5做in-place 升级时,必须copy P_S库,否则启动MySQL会提示错误。
下面以MySQL5.5.30新安装的示例:
mysql> select @@version;
+------------+
| @@version  |
+------------+
| 5.5.30-log |
+------------+
1 row in set (0.01 sec)

mysql> show variables like 'performance_schema';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| performance_schema | OFF   |
+--------------------+-------+
1 row in set (0.00 sec)

mysql> select TABLE_SCHEMA,TABLE_NAME from information_schema.tables where TABLE_SCHEMA='performance_schema';
+--------------------+----------------------------------------------+
| TABLE_SCHEMA       | TABLE_NAME                                   |
+--------------------+----------------------------------------------+
| performance_schema | cond_instances                               |
| performance_schema | events_waits_current                         |
| performance_schema | events_waits_history                         |
| performance_schema | events_waits_history_long                    |
| performance_schema | events_waits_summary_by_instance             |
| performance_schema | events_waits_summary_by_thread_by_event_name |
| performance_schema | events_waits_summary_global_by_event_name    |
| performance_schema | file_instances                               |
| performance_schema | file_summary_by_event_name                   |
| performance_schema | file_summary_by_instance                     |
| performance_schema | mutex_instances                              |
| performance_schema | performance_timers                           |
| performance_schema | rwlock_instances                             |
| performance_schema | setup_consumers                              |
| performance_schema | setup_instruments                            |
| performance_schema | setup_timers                                 |
| performance_schema | threads                                      |
+--------------------+----------------------------------------------+
17 rows in set (0.00 sec)

CON9309_Profiling with Performance Schema.pdf (2.91 MB, 下载次数: 533) 这里讲了5.5, 5.6我之前提的“打开”的具体含义。
别外看一下5.5手册里:Chapter 20. MySQL Performance Schema


   

论坛徽章:
0
7 [报告]
发表于 2013-04-10 17:53 |只看该作者
回复 6# RogerZhuo


这个问题我没能在以下版本中得到很好的解决:
+--------------+
| version()    |
+--------------+
| 5.5.3-m3-log |
+--------------+

估计是该版本对performance支持的不是很好。
mysql> select table_name from information_schema.tables where table_schema = 'per
formance_schema';
+----------------------------------------------+
| table_name                                   |
+----------------------------------------------+
| COND_INSTANCES                               |
| EVENTS_WAITS_CURRENT                         |
| EVENTS_WAITS_HISTORY                         |
| EVENTS_WAITS_HISTORY_LONG                    |
| EVENTS_WAITS_SUMMARY_BY_EVENT_NAME           |
| EVENTS_WAITS_SUMMARY_BY_INSTANCE             |
| EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME |
| FILE_INSTANCES                               |
| FILE_SUMMARY_BY_EVENT_NAME                   |
| FILE_SUMMARY_BY_INSTANCE                     |
| MUTEX_INSTANCES                              |
| PERFORMANCE_TIMERS                           |
| PROCESSLIST                                  |
| RWLOCK_INSTANCES                             |
| SETUP_CONSUMERS                              |
| SETUP_INSTRUMENTS                            |
| SETUP_OBJECTS                                |
| SETUP_TIMERS                                 |
+----------------------------------------------+
18 rows in set (0.00 sec)

库中有表,但不是自动创建出来的。我通过删除该库,重启服务,手动执行mysql_upgrade命令才会生成p_s的库和表。看了下mysql_upgrade的输出内容,除了已有的表,唯一做的就是修复表执行mysql_fix_privilege_tables该命令。
之前的错误是不允许使用命令。应该不是权限问题。

之后再报如下问题:
ERROR 1682 (HY000): Native table 'performance_schema'.'EVENTS_WAITS_CURRENT' has the wrong structure
查了下 有说是information_schema的问题。

因为是测试用机。我重新下了二进制包。开启服务没有遇到该问题。相信即使是使用新版本的mysql编译安装也应该不会遇到类似问题。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP