Chapter 3. MySQL Basics
Although the bulk of this new edition of MySQL in a Nutshell contains reference information, which you can read in small segments as needed, this chapter presents a basic MySQL tutorial. It explains how to log in to the MySQL server through the mysql client, create a database, create tables within a database, and enter and manipulate data in tables.
This tutorial does not cover MySQL in depth. Instead, it’s more of a sampler; it’s meant to show you what’s possible and to get you thinking about how to approach tasks in MySQL.
The mysql Client
There are various methods of interacting with the MySQL server to develop or work with a MySQL database. The most basic interface that you can use is the mysql client. With it, you can interact with the server from either the command line or within an interface environment.
If MySQL was installed properly on your server,
mysql should be available for use. If not, see Chapter 2. On Unix-based systems, you can type
whereis mysql. Windows, Macintosh, and other GUI-type
systems have a program location utility for finding a program. If you used
the default installation method, the mysql program
probably resides at /usr/local/mysql/bin/mysql. On
Unix systems, if /usr/local/mysql/bin/ is in your
default path (the PATH environment variable), you
can specify mysql without the full pathname. If the
directory is not in your path, you can add it by entering:
PATH=$PATH:/usr/local/mysql/bin export PATH
Assuming that everything is working, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access