![]() For instance, if you have a text file named mysqlscript.txt containing MySQL commands, one per line, you could use this command: mysql -u username -p db_name output.txt Instead of using mysql interactively, you can execute MySQL statements from a script file. ![]() To end your mysql session and return to the shell prompt, use the command: mysql> QUIT Running MySQL commands from a batch script to display the mathematical product of 2 and 21. to begin using the database named dbname, or: mysql> SELECT 21 * 2 AS meaning_of_life To list the databases which exist, or: mysql> USE dbname You are shown a brief introduction message and then placed at the mysql> prompt.Īt the mysql> prompt, enter MySQL commands, such as: mysql> SHOW DATABASES ![]() ![]() The simplest way to invoke mysql is to specify your MySQL username with the -u option, and to tell mysql to prompt you for your password with -p: mysql -u username -p The output format can be changed using command options. When used non-interactively, the result is presented in tab-separated format. ![]() When mysql is used interactively, query results are presented in a table format. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |