harkerboy
April 20th, 2006, 07:40 PM
I've got the following code seems runnable
# dbConn.rb
require "mysql"
begin
dbname="aDatabase"
print "Please enter your user name associating with mysql DB: "
uName= gets
print "Please enter your password: "
pwd= gets
m = Mysql.real_connect("localhost",uName,pwd)
m.select_db(dbname)
result = m.query("SELECT * FROM ping_content")
m.close
end
But when I attempt to run it, it returns Access denied as shown below. Anyone got idea on why?
george@linux:~/updating> ruby dbConn.rb
Please enter your user name associating with mysql DB: root
Please enter your password: xxxxxx
dbConn.rb:14:in `real_connect': Access denied for user: 'root (Mysql::Error)
@localhost' (Using password: YES) from dbConn.rb:14
# dbConn.rb
require "mysql"
begin
dbname="aDatabase"
print "Please enter your user name associating with mysql DB: "
uName= gets
print "Please enter your password: "
pwd= gets
m = Mysql.real_connect("localhost",uName,pwd)
m.select_db(dbname)
result = m.query("SELECT * FROM ping_content")
m.close
end
But when I attempt to run it, it returns Access denied as shown below. Anyone got idea on why?
george@linux:~/updating> ruby dbConn.rb
Please enter your user name associating with mysql DB: root
Please enter your password: xxxxxx
dbConn.rb:14:in `real_connect': Access denied for user: 'root (Mysql::Error)
@localhost' (Using password: YES) from dbConn.rb:14