MySQL Forums
Forum List  »  Router & Proxy

module 'mysql.password' not found: (tutorial.scramble)
Posted by: Rakhitha Karunarathne
Date: December 24, 2013 02:07PM

Hi...!

I am writing a script based on tutorial.scramble example. But i am getting following error which seems to be due to a missing module. But I cant find any missing file.

Can you guys please point what am I doing wrong?

Error

2013-12-25 01:15:22: (critical) (lua-error) [E:\Downloads\MySQL\proxy\script.txt]
[string "E:\Downloads\MySQL\proxy\script.txt"]:2: module 'mysql.password' not found:
        no field package.preload['mysql.password']
        no file 'E:\Downloads\MySQL\proxy\lib\mysql-proxy\lua\mysql\password.lua'
        no file 'E:\Downloads\MySQL\proxy\bin\lua-mysql\password.dll'
        no module 'mysql.password' in file 'E:\Downloads\MySQL\proxy\bin\lua-mysql.dll'

Script

local proto = assert(require("mysql.proto"))
local password = assert(require("mysql.password"))


function read_auth()
        print("    username      : " .. proxy.connection.client.username)
        print("    password      : " .. string.format("%q", proxy.connection.client.scrambled_password))

    local c = proxy.connection.client
    local s = proxy.connection.server

    if c.username == "test" and -- the username we want to map
            password.check(
                    s.scramble_buffer,
                    c.scrambled_password,
                    password.hash(password.hash("test")) -- its valid password
            ) then 

            proxy.queries:append(1,
                    proto.to_response_packet({
                            username = "root", 
                            response = password.scramble(s.scramble_buffer, password.hash("admin")),
                            charset  = 8, -- default charset
                            database = c.default_db,
                            max_packet_size = 1 * 1024 * 1024
                    })
            )

            return proxy.PROXY_SEND_QUERY  -- works if you use lp:mysql-proxy r694 or later
    end
	
end

Options: ReplyQuote


Subject
Views
Written By
Posted
module 'mysql.password' not found: (tutorial.scramble)
5985
December 24, 2013 02:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.