O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing SQL Statements

Now let’s look at how the mysql program is used to execute a SQL statement on a MySQL database.

Selecting a Database to Use

Your username and password give you access to one or more specific databases. For instance, if you are using a MySQL server provided by your web host, your username will give you access only to the database that is included with your web space. Other customers have their own individual passwords.

When you are connected to MySQL, issue the show databases command to see which databases are available to you. The SHOW DATABASES command is specific to MySQL but is executed through the mysql program like all other SQL commands.

mysql> Show Databases; +--------------------+ | Database | +--------------------+ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required