top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to process error messages using MySQL Proxy in lua script?

0 votes
384 views

I am using MySQL Proxy. When I type command like "show databa;" I should get error messages from MySQL server, which is forwarded by MySQL Proxy. How can I access this error message, modify it, and then send the modified error message to the client?

posted Apr 17, 2017 by Kavyashree

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+2 votes

Does anyone by chance have a working example of mysql-proxy lua script this can:

  • First return OK to a client
  • Then actually execute the query on server, ignoring the results.
0 votes

I have a mysql query that would not execute and I would like to display information about why that's happening.

$myQuery= $mysqli->query("UPDATE table SET id = 1 WHERE id = 3");
if(!$myQuery) //If query couldnt be executed
{
echo $mysqli->error; //Display information about why wasnt executed (eg. Error: couldnt find table)
}
+1 vote

Is there a way to make python script that connects to mySQL DB ask for a password on the:

conn = mdb.connect(host, user)
+1 vote

I have kept all the create table SQL querys in a text file. Using readLines i am trying to execute the sql commands as per the code mentioned.

file=open("TABLES.txt","r")
for sql in file.readlines():
self.cursor.execute(sql)

But I am getting Error 1065 ' Query was empty'. More Importantly the tables are being created in the database. The text file is like this.

CREATE TABLE TUserDetails (FirstName VarChar(50) NOT NULL, LastName VarChar(50) NOT NULL, Email_Id VarChar(50) NOT NULL,Type VarChar(50) NOT NULL,Department VarChar(50) NOT NULL,NoOfIncorrectAttempt Integer NOT NULL,Deleted Bit NOT NULL,UserID VarChar(50) NOT NULL,CONSTRAINT TUserDetails_PK PRIMARY KEY CLUSTERED ( UserID ))

CREATE TABLE TRequests(RequestID VarChar(50) NOT NULL,UserID VarChar(50) NOT NULL,Status SmallInt NOT NULL,TimeOfRequest Timestamp NOT NULL,Deleted Bit NOT NULL,Priority Integer NOT NULL,CONSTRAINT TRequests_PK PRIMARY KEY CLUSTERED ( RequestID ))

CREATE TABLE TUserDetailUSERs(UserID VarChar(50) NOT NULL, Type VarChar(50) NOT NULL,Deleted Bit NOT NULL,TimeOfCreation Timestamp NOT NULL,TimeLastUpdated Timestamp NOT NULL,Active Bit NOT NULL,PWDID VarChar(50) NOT NULL,RoleID VarChar(50) NOT NULL,OrganisationID Integer NOT NULL,CONSTRAINT TUserDetailUSERs_PK PRIMARY KEY CLUSTERED ( UserID ))

CREATE TABLE TOrganisations(OrganisationID Integer NOT NULL,OrganisationName VarChar(50) NOT NULL,TimeOfCreation Timestamp NOT NULL,TimeLastUpdated Timestamp NOT NULL, Deleted Bit NOT NULL, CONSTRAINT TOrganisations_PK PRIMARY KEY CLUSTERED ( OrganisationID ))

CREATE TABLE TPWDs(PWDID VarChar(50) NOT NULL,Code VarChar(50) NOT NULL,DateOfCreation Timestamp NOT NULL,DateLastUpdated Timestamp NOT NULL,TimeOfDeletion Timestamp NOT NULL, CONSTRAINT TPWDs_PK PRIMARY KEY CLUSTERED ( PWDID ))

CREATE TABLE TRoles(RoleID VarChar(50) NOT NULL,RoleName VarChar(50) NOT NULL,Description VarChar(50) NOT NULL,TimeOfCreation Timestamp NOT NULL, RoleLastUpdated VarChar(50) NOT NULL, Deleted Bit NOT NULL, CONSTRAINT TRoles_PK PRIMARY KEY CLUSTERED ( RoleID ))

I checked running each sql query individually, and it is qorking file. Now although the tables are being created in the database but i am getting error 1065 as mentioned above

+2 votes

I am running MySQL 5.5.31 on FreeBSD 9.2. I have a web server with a miss-configured service that generates faulty connections. After a while, MySQl blocks any connection from the web server.

At some stage, I had set-up a script that would browse syslog log and look for a string like "Host 'xxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" and would then issue a mysqladmin flush-hosts.

But after an upgrade, MySQl stopped reporting to syslog. Any help will be greatly appreciated.

...