Most of the phrases in this book assume that you are interactively entering commands into mysql, the MySQL command-line client. You can, however, just as easily store the commands in plain text files and then use mysql (or some other client) to run the commands.
In the first example, you are running mysql in batch mode on the command line. In batch mode, mysql runs one or more commands, displays output (if any), and then exits.
More specifically, in the first example, mysql
In the second example, the contents of file file_name.sql are read in by the client and sent to the server. The important things to note are that you are already using the mysql command-line client in interactive mode.
The \. command is (hopefully) unrelated to Slashdot, the infamous technology news site. Instead, its name derives from the UNIX shell source command, which is used to process the text of a file as a set of shell commands. In most Unix shells, the command is invoked as shell> . some_file_name.