How to do login in mysql with unix shell

By below method if password is pass and user name is root

# [mysql dir]/bin/mysql -h hostname -u root -p pass

To log in to MySQL using the Unix shell, you can use the mysql command along with the appropriate options. Here’s the general syntax:

bash
mysql -u your_username -p

Replace your_username with your MySQL username. After running this command, you will be prompted to enter your MySQL password. Once you provide the correct password, you’ll be logged into the MySQL shell.

For example:

bash
mysql -u myuser -p

After entering this command, you’ll be prompted to enter the password for the MySQL user “myuser”.

Make sure that you have the MySQL client installed on your system, and the MySQL server is running. Additionally, ensure that you have the necessary permissions to access the MySQL server from the Unix shell.