MySQL CLI for Beginners

Introduction

I find that the majority of webmasters (and even some sysadmins!) who work with MySQL use phpMyAdmin as a web-based front-end management tool for MySQL. Whilst phpMyAdmin makes database management a breeze, for those interested in some ‘command line interface’ experience with MySQL, I’ve pieced together some beginner notes from various websites…

Creating a Database

In order to create a database you need to have the PRIVILEGES- this may be because you are the root user or you (or you systems administrator) has created an admin user that has ALL PRIVILEGES over all databases. In these examples a user called ‘admin’ has been created precisely for this purpose. Creating a database is fairly straightforward.

Logging In

A reminder of how to start the MySQL Client Software, and as we are not concerned with manipulating just one database we don’t have to specify a database as part of our startup command.

$ mysql -u <username> -p
Enter password: