Learning Objectives :
- List the available clients for administrative tasks and their basic purposes.
- Invoke mysql clients and common command line options.
- Invoke and us the MySQL command line client MySQL.
- Use the mysqladmin for administrative clients APIs (Drivers and Connectors).
Overview of Administrative Clients :
Command line clients programs for DBA’s.
To know what are all options mysql will support you can check using mysql –help command.
How to connect MySQL using mysql command :
mysql <option1> <option2>…
-p <password> (you can give your password or you can press enter and type password when it port for it)
-P <port number> (default port number 3306 if mysql is not running on default port you need to specify here)
-h <host number> (if you are connecting from remote host give host name/ip address)
There are 2 categories of switches supported by mysql command line :
SHORT FORMAT :
Where you are specifying –u or –p or any other option
LONG FORMAT :
Where you specifying –user=<username>
We can execute mysql commands in two modes.They are :
We are executing commands by connecting mysql > prompt.
We are executing commands from operating system prompt.(but its insecure)
we will use for day to day tasks).
You can manually check for contents for help for mysql command, execute mysql> help contents this will show you list of categories of content.
For example let’s check what are functions are available in Functions.
In above date and time function below listed options are available.
To get example how to use above options execute mysql> HELP ADDDATE;
There are two ways to execute query one way is by executing query after connecting to mysql prompt and another way is you can execute quires from OS prompt without connecting mysql.
As shown below you can append query to mtsql –u<user> -e “<query you want to execute>”
If you want to execute multiple commands in that case separate them with semicolon ( ; ) as shown below.
We can also write multiple queries .
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform