Access MySQL Server From The Shell Prompt (Command Line)

Access MySQL Server From The Shell Prompt (Command Line)

To access a MySQL server from the shell prompt (command line), you will need to use the MySQL command-line client. The MySQL command-line client is a command-line tool that allows you to connect to a MySQL server and execute SQL statements.

Here are the steps to access a MySQL server from the shell prompt (command line) using the MySQL command-line client:

  1. Open a terminal and type the following command to log in to the MySQL server:
mysql -u username -p
Sou‮r‬ce:www.lautturi.com

Replace "username" with the username of a MySQL account that has access to the server. You will be prompted to enter the password for the account.

  1. Once you have logged in to the MySQL server, you can execute SQL statements at the MySQL command prompt. For example:
mysql> SELECT * FROM users;

This will execute a SELECT statement that retrieves all rows from the "users" table.

  1. To exit the MySQL command-line client, type the "exit" command or press Ctrl+D.

With these steps, you should be able to access a MySQL server from the shell prompt (command line) and execute SQL statements using the MySQL command-line client.

Note: The MySQL command-line client is just one way to access a MySQL server from the command line. You can also use other tools such as the "mysqlsh" or "mysqldump" command-line utilities to connect to and manipulate a MySQL server from the command line.

Created Time:2017-10-27 14:56:33  Author:lautturi