this is an example but its not working. The file name is "mysql_login.sh"
#!/bin/bash
login_sql=" --login-path=local "
echo -e "PASSQORD345\n" | sudo -S mysql $login_sql $1
my motto is when i will run the file "$sh mysql_login.sh db_name" from command line then it will log in to mysql and use the db db_name.
currently i need to log in as root with root pas then its working but i want , i will just run the sh file then it will log in as root with root password and will log in in mysql server.
Error getting : ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)