Chapter 3. MySQL Basics
While the bulk of MySQL in a Nutshell contains reference information, which you can read in small segments as needed, this chapter presents a basic tutorial on MySQL. It explains how to log in to the MySQL server, create databases, and enter and manipulate data within them. This tutorial does not cover everything about MySQL. 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 for interacting with the MySQL server and, thereby, developing or working with a database. The most basic interface that you can use, though, is the mysql client. With it, you may interact with the server from either the command line or what is sometimes called the monitor.
If MySQL was installed properly on your server, mysql should be available to run. If not see Chapter 2. If you used the default installation method, the mysql program resides at /usr/local/mysql/bin/mysql. On Unix systems, be sure that mysql is in your path by typing:
PATH=$PATH:/usr/local/mysql/bin export PATH
Assuming that everything is working, you will also need a MySQL username and an accompanying password. If you're not the administrator, you must obtain these from her. If MySQL was just installed and the root password is not set yet, its password is blank. See Chapter 2 to learn how to set passwords, and to create new users and grant them privileges.
From a shell prompt, log in to MySQL like ...
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