mysql -u user -p pass -h remotehost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 96
Server version: 5.1.36-community-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Suppose the remotehost's OS is linux,
how do I switch to shell mode?
UPDATE
I get access to database via shell prompt.
I meant to access shell prompt of remotehost,typing exit
will return to my own shell prompt.
Having database access doesn't imply that you have shell access. I have a a database at work to which many co-workers have access with some user/password combination. However, none of them have a shell login, because they don't need it.
A MySQL connection and a "shell" connection are completely independent, even if they appear to go to the same address. You can't switch from one to other directly; you have to exit the MySQL client and start a SSH client in its place.
I take it you connecting by running the above command from your own machine..
There is no way to gain remote system shell access from within the mysql shell, so unless you have not been provided with a system login account for the remote host you are probably out of luck.
Provided a login account you could typically use SSH or telnet to access the remote host.
You fail to describe how you "got database access". If it was by executing the mysql client from a shell prompt, then simply exiting the mysql console will drop you back to the shell. However, if your database access is over the web (e.g. phpmyadmin), you can't just "switch to shell".
More info needed.
You cannot get to a shell from the MySQL monitor, for security reasons. Unless the system authenticates against the database using pam_mysql, and you can add new database users (it's ridiculously unlikely that both would be true, due to security concerns), you are out of luck.
Actually if the mysql is run as a root user and you have specific privileges, then you could but it would also get you in a boat load of trouble considering it would grant you the same user access as the mysql account itself.
Because the only reason you would even do what I am think is to gain access to a system you don't have the privileges or rights to, I won't say how because that would be unethical but I can say for sure there is a way.