DBI::DatabaseError: Access denied for user error When connect the remote Mysql Server use Ruby DBI -


here sample code using dbi:

db = dbi.connect("dbi:mysql:database=testdatabase;host=testhost;port=30012", "testuser", "testpassword") 

it returned, , looks no problem:

#<dbi::databasehandle:0x00000001c7f0f0 @handle=#<dbi::dbd::mysql::database:0x00000001c9f148 @handle=#<mysql:0x00000001ca6678>, @attr={"autocommit"=>true}, @have_transactions=true, @mutex=#<mutex:0x00000001c813f0>>, @trace_output=nil, @trace_mode=nil, @convert_types=true, @driver_name="mysql">  

and call "prepare" method:

sql = "select * users id in (?)" dbh = db.prepare(sql) 

and looks ok(the follow code part of return):

#<dbi::statementhandle:0x00000005e404a8 @handle=#<dbi::dbd::mysql::statement:0x00000005e42118 @attr={}, @mutex=#<mutex:0x00000001c813f0>, @handle=#<mysql:0x00000001ca6678>, @parent=#<dbi::dbd::mysql::database:0x00000001c9f148 @handle=#<mysql:0x00000001ca6678>, @attr={"autocommit"=>true}, @have_transactions=true, @mutex=#<mutex:0x00000001c813f0>> 

but when use "execute" method:

dbh.execute('1,2,3') 

then occur error:

dbi::databaseerror: access denied user 'testuser'@'120.120.120.120' (using password: yes) 

i'm sorry, mistook direction of question, actually, cause of problem "into outfile" method privileges. need mysql open "file" privileges. this:

grant file on *.* 'username'@'hostname'; 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -