mysql login through command line code example Example 1: login mysql mysql -u root -p Example 2: login to mysql database mysql -u root -p databasename