How do I login to a MySQL database?

By Alvin J. Alexander, devdaily.com

Assuming you have the root password, this will work:

mysql -u root -p

You should then be prompted for the root password. Once you login your console should look like this (using MySQL version 5):

C:\>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

devdaily logo