Search code examples
mysqldatabaseterminallocalhostsequelpro

Can't connect to localhost MySQL database through command line?


Weird issue. Can't connect to localhost MySQL database from command line, but I can through MySQL program, Sequel Pro. Any ideas why? I entered the same user/password, but I'm getting a access denied error for root@localhost

Extra question: can you run MySQL commands within Sequel Pro? I'm pretty new to MySQL, but I'm just trying to change a simple column definition.

EDIT: reset password from within Sequel Pro query for root, and was able to get it working.


Solution

  • MySQL has different accesses. You can allow a MySQL database to only serve requests from a specific machine, or only from the local machine.

    However, note that MySQL differentiates login from "localhost" and from "127.0.0.1".

    Try allowing both localhost, 127.0.0.1 and "%" to the account.