I have a Rails 4.2 application deployed to an Ubunutu 14.4 Trusty server. The issue I'm having right now is being unable to run a script that saves records for me. I get this error:
Access denied for user 'root'@'localhost' (using password: NO) (Mysql2::Error)
I've configured the production database to use username root with the right password, yet after restarting the server and trying out the new configuration I get the above error.
I'm running to script by navigating to lib/ on the server and running ruby script9000.rb
. The script runs fine until it tries to save a record.
Why might this be happening?
The script trips up at Year.find_or_create_by
def save_record(record)
sanitize_record(record)
full_year = complete_year(@@record["year_number"])
if full_year >= 2014
year = Year.find_or_create_by(year: full_year)
year.records.create(@@record)
end
end
Access denied for user 'root'@'localhost' (using password: NO)
It is MySQL error, that means that you are trying to connect to database with the user root from localhost with blank or no password. Make sure, you have user root@localhost on your mysql server or make sure to provide right password.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With