-1

I see this error when I startup mysql:

mysql
ERROR 1045 (28000): Access denied for user 'jwan'@'localhost' (using password: NO)

This is my mysql version:

mysql --version
mysql  Ver 14.14 Distrib 5.7.23

What can I do? Is using sudo bad here to do?

I inherited this rails project and this is my database.yml:

development:
  adapter: mysql2
  database: some_database
  username: root
  password:
  host: localhost
  port: 3306
Jwan622
  • 11,015
  • 21
  • 88
  • 181

1 Answers1

0

If this is a fresh MySQL installation, you don't have a user account created yet. Try logging in as the root user: mysql -u root. The first thing you should do is set a password for the root account. Then you can create user accounts.

If this is an existing database, ask the administrator which user account and password you are supposed to use. Then access with mysql -u YourUserName -p. It will ask for a password.

Joni
  • 108,737
  • 14
  • 143
  • 193
  • `mysql -u root` does not work but `mysql -u root -p` does and I entered in my user password when I login to my mac. How do I create user accounts? – Jwan622 Oct 10 '18 at 15:07
  • create user (...) identifed by (...) https://dev.mysql.com/doc/refman/8.0/en/adding-users.html – Joni Oct 10 '18 at 15:19