Save 36% for Black Friday! Save 36% on GoRails for Black Friday! Learn more
Activity
Posted in Mysql2::Error::ConnectionError: Access denied for user 'root'@'localhost' (using password: NO)
Try this on your database.yml:
default: &default
adapter: mysql2
username: root
password:
socket: /tmp/mysql.sock
Mysql usually come with auth_socket as default authentication plugin, if you want to use authentication by password, you must change the user's authentication plugin to caching_sha2_password.
You can try to run this on MySQL terminal:
mysql> CREATE USER ‘username’@‘localhost’ IDENTIFIED BY ‘password’;
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
mysql> FLUSH PRIVILEGES;
Then you should be good to go.