MySQL is known as an open source relational database. MySQL is written in C and C++ language and developed by the Swedish company in 1995. It is used for adding, accessing and managing content in different web servers database, and also support SQL commands such as ADD, DROP, INSERT and UPDATE etc. This tutorial describes how to connect MYSQL from the command line.

Steps to connect MySQL from the command line:

You can access your database through SSH and make the changes through the command line with the below steps

Step 1: Open your putty software and enter the valid username and password.

Step 2: Type the below command and execute the command.

mysql -u Username -p

Example: myssql -u csdemo2w_root -p

Note: If you wish to use MySQL root password, change the default password to a new password in WHM. It can be done under SQL Services -> MySQL Root Password in WHM.

Step 3: In Enter Password prompt, type your valid password. After entering your password, mysql>prompt appears.

Step 4: If you want to display the available databases, type the following command at the mysql>prompt.

mysql>show databases;

Step 5: To view the specific database, type the following command at the mysql>prompt.

mysql>use database name;

After executing these commands you can run the SQL queries, view tables and modify table with help of SQL commands. For more information, follow us on Twitter and Facebook and For video tutorials, subscribe to our YouTube channel ServerCake India.

Tagged in:

,