-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Ubuntu Server Cookbook
By :
In this recipe, we will learn how to create databases and tables and store data in those tables. We will learn the basic Structured Query Language (SQL) required for working with MySQL. We will focus on using the command-line MySQL client for this tutorial, but you can use the same queries with any client software or code.
Ensure that the MySQL server is installed and running. You will need administrative access to the MySQL server. Alternatively, you can use the root account of MySQL.
Follow these steps to store and retrieve data with MySQL:
First, we will need to connect to the MySQL server. Replace admin with a user account on the MySQL server. You can use root as well but it’s not recommended:
$ mysql -u admin -h localhost -p
When prompted, enter the password for the admin account. If the password is correct, you will see the following MySQL prompt:

Create a database with the following query. Note the semi-colon at the end...