Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqladvisor :Invalid parameter number 怎么会出现这个问题 #73

Open
zouxuewei opened this issue Jul 16, 2018 · 4 comments
Open

sqladvisor :Invalid parameter number 怎么会出现这个问题 #73

zouxuewei opened this issue Jul 16, 2018 · 4 comments

Comments

@zouxuewei
Copy link

2018-07-16 23:12:34 50130 [Note] 第1步: 对SQL解析优化之后得到的SQL:select * AS * from crmdb2.tbl_dept where ((1 = 1) and (id > 50) and (id < 100))

2018-07-16 23:12:34 50130 [Note] 第2步:开始解析where中的条件:(id > 50)

2018-07-16 23:12:34 50130 [Note] 第3步:SQLAdvisor结束!错误日志:Invalid parameter number

@xiaojing413332
Copy link

xiaojing413332 commented Jul 30, 2018

./sqladvisor -h xxx -P 3306 -u admin -p 'xxx' -d sql_audit -q "SELECT * FROM product_spu_modify where CreateTime > '2018-07-29 14:15:46';" -v 1
2018-07-30 17:51:19 10008 [Note] 第1步: 对SQL解析优化之后得到的SQL:select * AS * from sql_audit.product_spu_modify where (CreateTime > '2018-07-29 14:15:46')

2018-07-30 17:51:19 10008 [Note] 第2步:开始解析where中的条件:(CreateTime > '2018-07-29 14:15:46')

2018-07-30 17:51:19 10008 [Note] 第3步:SQLAdvisor结束!错误日志:Invalid parameter number

同问,没有详细日志,完全不知道怎么排查啊

@xiaojing413332
Copy link

xiaojing413332 commented Aug 2, 2018

经过多方面测试,问题解决了,问题出在centos安装的php-mysql扩展,会出现上面SQLAdvisor结束!错误日志:Invalid parameter number!!!!使用php-mysqlnd 替换掉php-mysql 。问题即可解决。

2018-08-02 14:57:12 5294 [Note] 第5步:字段CreateTime不是主键。表名:product_spu_modify

2018-08-02 14:57:12 5294 [Note] 第6步:开始验证 字段CreateTime是不是主键。表名:product_spu_modify

2018-08-02 14:57:12 5294 [Note] show index from product_spu_modify where Key_name = 'PRIMARY' and Column_name ='CreateTime' and Seq_in_index = 1

2018-08-02 14:57:12 5294 [Note] 第7步:字段CreateTime不是主键。表名:product_spu_modify

2018-08-02 14:57:12 5294 [Note] 第8步:开始验证表中是否已存在相关索引。表名:product_spu_modify, 字段名:CreateTime, 在索引中的位置:1

2018-08-02 14:57:12 5294 [Note] show index from product_spu_modify where Column_name ='CreateTime' and Seq_in_index =1

2018-08-02 14:57:12 5294 [Note] 第9步:开始输出表product_spu_modify索引优化建议:

2018-08-02 14:57:12 5294 [Note] Create_Index_SQL:alter table product_spu_modify add index idx_CreateTime(CreateTime)

2018-08-02 14:57:12 5294 [Note] 第10步: SQLAdvisor结束!

@bansen
Copy link

bansen commented Dec 11, 2018

怎么会跟php-mysql有关系呢

@CMWFireworm
Copy link

怎么会跟php-mysql有关系呢

cp /lib64/libmysqlclient.so.18 /usr/local/sqlparser/lib/ 可以将libmysqlclient.so.18 拷到sqlparser/lib下面,本人测试有效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants