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

1049: Unknown database 'xyz;' error while executing prepared statement #915

Closed
krupal-raiyani opened this issue Feb 16, 2017 · 12 comments
Closed
Assignees
Milestone

Comments

@krupal-raiyani
Copy link

I am new to proxysql, this might be configuration issue or already reported one.

We have php application with laravel frame work which connect the Mysql DB, application is successfully able to connect with DB and perform all the operation without proxySQL. But when ever we point application to proxysql which connects to same DB, this gives below during the DB connection or at the time of prepared statement execution.

2017-01-27 12:38:57 MySQL_Session.cpp:1004:handler_again___status_CHANGING_SCHEMA(): [WARNING] Error during INIT_DB: 1049, Unknown database 'elitedb;'
2017-01-27 12:38:58 mysql_connection.cpp:559:handler(): [ERROR] Failed to mysql_real_connect() on 192.168.6.140:3340 , FD (Conn:34 , MyDS:34) , 1049: Unknown database 'elitedb;'.

Then we have capture the network traces to find out the difference.

App IP : 192.168.6.133
Proxy SQL : 192.168.6.140
Mysql : 192.168.6.140
DB name : elitedb

Version : ProxySQL version 1.3.2-1, codename Truls

image

filter_proxy_issue_gh.zip
without_proxy_gh.zip

I hope you get my point, Thanks in advance..

@renecannao renecannao added this to the v1.3.4 milestone Feb 16, 2017
@renecannao renecannao self-assigned this Feb 16, 2017
@renecannao renecannao added the bug label Feb 16, 2017
@renecannao
Copy link
Contributor

Hi @krupal-raiyani . Thank you for the report.
It seems the application (laravel framework in this case) is sending an extra ; and ProxySQL parses it as part of the schemaname.
I will fix this in the next release.

@renecannao
Copy link
Contributor

Issue fixed and tested in branches v1.3.4-dev and v1.4.0.
Thank you for report!

@krupal-raiyani
Copy link
Author

Hi @renecannao . Thanks for quick update...

We are planning to deploy the same in production environment. If you could provide the tentative date for the same that will be really help full for us.

Thanks again..

@renecannao
Copy link
Contributor

I was trying to fix #896 before releasing 1.3.4 .
#896 seems to affect only one user, and I wasn't able to reproduce it.
If I am not able to fix it by tomorrow, I will release 1.3.4 nonetheless.

@krupal-raiyani
Copy link
Author

Hi @renecannao .

Thanks for update.

We have changed the lines MySQL_Session.cpp in proxysql-1.3.3 to Remove trailing semicolon..

But when we compile the source by make, it give below errors

g++ -fPIC -c -o obj/ProxySQL_GloVars.oo ProxySQL_GloVars.cpp -std=c++11 -I../include -I../deps/jemalloc/jemalloc/include/jemalloc -I../deps/mariadb-client-library/mariadb_client/include -I../deps/libconfig/libconfig-1.4.9/lib -I../deps/re2/re2 -I../deps/sqlite3/sqlite3 -O2 -ggdb -Wall -DGITVERSION=""
cc1plus: error: unrecognized command line option "-std=c++11"
make[1]: *** [obj/ProxySQL_GloVars.oo] Error 1
make[1]: Leaving directory `/root/proxysql_fix/proxysql-1.3.3/lib'
make: *** [build_lib] Error 2
[root@localhost proxysql-1.3.3]#

-------------below is over gcc version

[root@localhost proxysql-1.3.3]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
[root@localhost proxysql-1.3.3]#


Below are the files which contains the same flag

[root@localhost proxysql-1.3.3]# grep -r "=c++11" *
lib/Makefile:#CPPFLAGS=-std=c++11 $(CFLAGS) $(LDIRS) $(LIBS)
lib/Makefile:MYCPPFLAGS=-std=c++11 $(MYCFLAGS)
src/Makefile:MYCPPFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG)
test/encrypt/Makefile:MYCPPFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG) -ggdb
test/PrepStmt/Makefile:MYCPPFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG) -ggdb
test/ChangeUser/Makefile:MYCPPFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG) -ggdb
test/regextest/Makefile:MYCPPFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG) -ggdb
[root@localhost proxysql-1.3.3]#


This might be the gcc compability issue, where we might need the change the flag which support the same. Kindly provide your suggestion on the same.

Note : we might need to change the flag from "std=c++11 to -std=c++0x" reference : http://askubuntu.com/questions/871392/cc1plus-error-unrecognized-command-line-option-std-c11-i-am-getting-this

@renecannao
Copy link
Contributor

GCC 4.4. is very old.
I can build it for you.
Are you ok with an rpm for CentoOS 6.7?

@krupal-raiyani
Copy link
Author

We are using 6.8 RHEL

@renecannao
Copy link
Contributor

Ok, so an RPM for 6.7 will run on 6.8 .
Please give me some minutes to prepare il.

@renecannao
Copy link
Contributor

@krupal-raiyani : here it is!
proxysql-1.3.4-dev-1.x86_64.rpm.gz

Note that it will say version 1.3.3-6-g8ba7099 : this because 1.3.4 is not released yet

@krupal-raiyani
Copy link
Author

krupal-raiyani commented Feb 16, 2017 via email

@krupal-raiyani
Copy link
Author

Hi @renecannao

Many thanks for the same..

Issue is resolved.

Regards,
Krupal Raiyani

minichate pushed a commit to minichate/proxysql that referenced this issue Mar 6, 2017
@youzhny197
Copy link

Hello,
I have same problem when I use navicat to query database.
proxysql --version
ProxySQL version 1.4.3-1-g79a32d3, codename Truls

Failed to mysql_change_user()2017-09-20 10:19:58 MySQL_Session.cpp:1655:handler_again___status_CHANGING_USER_SERVER(): [WARNING] Error during change user: 1102, Incorrect database name 'test;
UPDATE test.test_log_201707 SET value=2600000 WHERE id=1;
'

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

No branches or pull requests

3 participants