When you log into MySQL at CLI, you have to define the username and password
mysql -uusername -ppassword [database]
You can add these to a config file (
.my.cnf) in the users home directory
and add these lines (changing the user and password of course)
[client] user=root password=password
and then you jus need to type
and you are in.
You can even define the database and other settings with some extra lines…
Note: the file ~/.my.cnf is a user specific login file. If you want all users to be able to login with these credentials, you can edit the global /etc/my.cnf file instead.