Lullabot Ideas
We know stuff. We empower you to know stuff too.
Command Line Basics: MySQL
Video by Addison BerrySeptember 21, 2010 - 4:19am
This video looks at the basics of working with MySQL from the command line. We get into the mysql environment and look at databases, tables and fields. We cover creating and deleting databases, creating a user, and querying within a particular database.

Comments
This series is great. Thanks
This series is great. Thanks add1sun for the time you spend on these.
It's great to encourage
It's great to encourage people to use command line tools.
Thank you Addison.
very nice
indeed :)
Thanks for sharing.
Thanks for sharing.
thanks
Thanks for all the command line basics - really help somebody like me who is new to all this.
ps. also liking the tube map in the background - you can see Clapham if you look closely (where I live!).
What does one do when the
What does one do when the first command example returns:
-bash: mysql: command not found
If mysql isn't found it can
If mysql isn't found it can be a number of issues...
Is it really installed?
Where is it installed isn't in your search path.
The command line will use the 'search path' to look for items to execute when you enter any command.
Use 'echo $PATH' to see the places in your $PATH (the search path).
Try 'locate mysql' or 'which mysql' to find the mysql binary path, then add this path to your .bash_profile (hidden file usually in your home directory).
export PATH="/usr/local/mysql/bin:$PATH"
Otherwise you can use mysql by specifying the full path to the binary, eg
/usr/local/mysql/bin/mysql -u root -p pass
/usr/local/mysql/bin/mysql -u
/usr/local/mysql/bin/mysql -u root -ppass
In most situations there mustn't be a space between -p and "password" or you can simple press Enter after -p options and input your password.
Shell prompt
Hi,
Thank you for your great tutorials and effort. I am using WAMP Server -2 on XP Pro machine. Now I can use only MySQL console and wondering how can I get the shell prompt line (as shoved on your video)?
many thanks in advance.
Good info
Hi,
Thanks for posting this quick tutorial it really help me out a lot. I am developing on my home machine using WAMP, so this help me with setting up my databases without using phpMyAdmin,