Skip to Main Content
Learning PHP, MySQL, and JavaScript
book

Learning PHP, MySQL, and JavaScript

by Robin Nixon
July 2009
Beginner content levelBeginner
526 pages
14h 24m
English
O'Reilly Media, Inc.
Content preview from Learning PHP, MySQL, and JavaScript

Accessing MySQL via the Command Line

There are three main ways in which you can interact with MySQL: using a command line, via a web interface such as phpMyAdmin, and through a programming language like PHP. We’ll start doing the third of these in Chapter 10, but for now, let’s look at the first two.

Starting the Command-Line Interface

The following sections describe relevant instructions for Windows, Mac OS X, and Linux.

Windows users

If you installed the EasyPHP WAMP as explained in Chapter 2, you will be able to access the MySQL executable from the following directory:

\Program Files\EasyPHP 3.0\mysql\bin

Note

If you installed EasyPHP in a place other than \Program Files, you will need to use that directory instead. Also, if the version of EasyPHP is not 3.0, you will need to change that, too.

By default, the initial MySQL user will be root and will not have had a password set. Seeing as this is a development server that only you should be able to access, we won’t worry about creating one yet.

So, to enter MySQL’s command-line interface, select Start→Run and enter CMD into the Run box, then press Return. This will call up a Windows Command prompt. From there, enter the following (making any appropriate changes as discussed previously):

"\Program Files\EasyPHP 3.0\mysql\bin\mysql" -u root

Note

Note the quotation marks surrounding the main path and filename. These are present because the name contains spaces, which the Command prompt doesn’t correctly interpret, and the quotation marks group ...

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.
Start your free trial

You might also like

Web Database Applications with PHP and MySQL, 2nd Edition

Web Database Applications with PHP and MySQL, 2nd Edition

Hugh E. Williams, David Lane
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 9780596803605Supplemental ContentErrata Page