Found 4378 Articles for MySQL

Executing SQL Statements from a Text File on MySQL Client

AmitDiwan
Updated on 10-Mar-2021 12:53:25

807 Views

Let us understand how SQL statements can be executed from a text file on the MySQL client. The mysql client is generally used in interactive way. Let us see an example of the same −shell> mysql db_namePlace SQL Satements in a Text FileIt is also possible to put the SQL statements in a file and then tell mysql to read the input from that specific file. To do this, a text file text_file is first created.This text file would contain the statements that need to be executed. Let us take an example to understand the same −shell> mysql db_name < ... Read More

MySQL Client Server-Side Help

AmitDiwan
Updated on 10-Mar-2021 12:52:36

431 Views

Let us understand the MySQL client-server side help −mysql> help search_stringIf an argument is provided to the above ‘help’ command, mysql will use it as a search string to access server-side help from the contents of the MySQL Reference Manual. The proper operation of this command needs that the help tables in the mysql database should be initialized with help topic information.If there is no match for the search string, then the search operation fails. Let us take an example to understand this −mysql> help meOutputNothing found Please try to run 'help contents' for a list of all accessible topicsWe ... Read More

MySQL Client Logging

AmitDiwan
Updated on 10-Mar-2021 12:51:05

315 Views

Let us understand about client logging with respect to MySQL. The mysql client can do different types of logging for statements that are executed, and it can be interactively −UNIX - LoggingOn Unix, mysql writes the statements to a history file. By default, this file is named as .mysql_history in the user’s home directory. To specify a different file name, the value of the MYSQL_HISTFILE environment variable has to be set.If the --syslog option is given, mysql will write the statements to the system logging facility on all kinds of platforms. On Unix, this is known as syslog.Windows - LoggingOn ... Read More

MySQL Client Commands

AmitDiwan
Updated on 10-Mar-2021 12:50:00

1K+ Views

Let us understand some of the MySQL client commands −MySQL sends every SQL statement that the user issues to the server so that it can be executed. There is also a set of commands that mysql interprets on its own.Get the List of CommandsThe list of these commands can be found by typing the below mentioned command on the prompt −mysql> helpOutputList of all MySQL commands: Note that all text commands must be first on line and end with ';' ? (\?) Synonym for `help'. clear     (\c) Clear the current input statement. connect   (\r) Reconnect to the ... Read More

MySQL Client Options

AmitDiwan
Updated on 10-Mar-2021 12:47:49

239 Views

The mysql supports the below mentioned options, which can be specified on the command line or in the [mysql] and [client] groups of an option file.--help, -?It helps display a help message and exit.--auto-rehashIt enables automatic rehashing. This option is set by default, which enables database, table, and column name completion.--auto-vertical-outputThis option causes the result sets to be displayed vertically if they are too wide for the current window, and it uses the normal tabular format otherwise.--batch, -BIt prints the results using tab as the column separator, with each row on a new line. With this option, mysql doesn’t use ... Read More

The MySQL Command-Line Client

AmitDiwan
Updated on 10-Mar-2021 12:45:56

922 Views

The mysql is a simple SQL shell that has input line editing capabilities. It supports interactive and noninteractive usage. When it is used interactively, query results are presented in an ASCII-table format. When it is used noninteractively, like a filter, the result would be presented in tab-separated format.The output format can be changed with the help of command options. If there are issues because of insufficient memory for large result sets, the --quick option can be used.This forces the mysql to retrieve results from the server, a row at a time instead of retrieving the entire result set at once ... Read More

MySQL Client Programs

AmitDiwan
Updated on 10-Mar-2021 12:44:27

3K+ Views

There are 7 client programs, which are listed below −mysqlmysqladminmysqlcheckmysqldumpmysqlimportmysqlpumpmysqlshowmysqlslapLet us understand the MySQL client programs in brief −mysqlThe mysql is a simple SQL shell that has input line editing capabilities. It supports interactive and noninteractive usage. When it is used interactively, query results are presented in an ASCII-table format.It can be invoked from the prompt of the user’s command interpreter. It has been demonstrated below −shell> mysql db_namemysqladminThe mysqladmin is a client that helps perform administrative operations. It can also be used to check the server's configuration and current status, to create and drop databases, and much more.mysqlcheckThe mysqlcheck ... Read More

mysql_upgrade - Check and Upgrade MySQL Tables

AmitDiwan
Updated on 10-Mar-2021 12:43:31

713 Views

Let us understand mysql_upgrade program −UsageEvery time MySQL is upgraded, the user should execute mysql_upgrade, that looks for incompatibilities with the upgraded MySQL server.It upgrades the system tables in the mysql schema so that the user can take advantage of new privileges or capabilities that could have been added after the upgrade.It basically upgrades the Performance Schema and sys schema.It also examines user schemas.If mysql_upgrade finds that a table has a possible incompatibility, it performs a table check and, if some problems are found, attempts a table repair operationThe mysql_upgrade can be used as shown below −Ensure that the server ... Read More

mysql_tzinfo_to_sql - Load the Time Zone Tables in MySQL

AmitDiwan
Updated on 10-Mar-2021 12:42:21

812 Views

The mysql_tzinfo_to_sql program helps load the time zone tables in the mysql database. It is used on systems which have a zoneinfo database, i.e the set of files that describe the time zones. Examples of such systems include Linux, FreeBSD, Solaris, and macOS. One most probable location for these files is the /usr/share/zoneinfo directory (/usr/share/lib/zoneinfo on Solaris).Invoking mysql_tzinfo_to_sqlIf the system doesn’t have a zoneinfo database, the downloadable package can be installed. The mysql_tzinfo_to_sql can be invoked in many ways. Some of them have been shown below −shell> mysql_tzinfo_to_sql tz_dir (or) shell> mysql_tzinfo_to_sql tz_file tz_name (or) shell> mysql_tzinfo_to_sql --leap tz_fileIn the ... Read More

mysql_ssl_rsa_setup - Create SSL/RSA Files in MySQL

AmitDiwan
Updated on 10-Mar-2021 12:41:22

538 Views

Let us understand mysql_ssl_rsa_setup program −This program helps create the SSL certificate, key files and the RSA key-pair files that are required to support secure connections with the help of SSL and secure password exchange using RSA over unencrypted connections, if they are missing. The mysql_ssl_rsa_setup program can be used to create new SSL files if the existing ones have expired.Invoking mysql_ssl_rsa_setupThe mysql_ssl_rsa_setup can be invoked as shown below −shell> mysql_ssl_rsa_setup [options]Some of the options include --datadir which is used to specify where to create the files, and the --verbose option to see the ‘openssl’ commands that mysql_ssl_rsa_setup executes.The ‘mysql_ssl_rsa_setup’ ... Read More

Advertisements