We all know that there is GUI available to connect MYSQL server (phpmyadmin). Most of the developers are not aware about connecting MYSQL server via terminal. Here we are going to explain how to connect a MYSQL server (both local & remote) via terminal.
i) First open the Terminal.
ii) Type the following command to connect to the server, general syntax is
mysql -u [db username] -h [db server name] -p
After enter the above command, press ENTER. Then the Terminal will prompt to enter the password to connect. If you given valid credentials, then the terminal will display the shell pointer as mysql>
Once the connection established you can manipulate the database using SQL commands.