Jump to content

Accessing MySQL through Command Line


Guest bozzio

Recommended Posts

Hey everyone, this is my first post and I am excited to get continue my learning of Web Design and Development with this great forum. I was wondering if someone could help me out with something.

 

I recently finished watching all of Stefan's PHP and MySQL tutorials (which were extremely helpful), and I installed XAMPP on my Mac OS X system with no problems after following his instructions.

 

My question is, by trying to continue my learning of PHP and MySQL I purchased Sitepoint's "Build Your Own Database Driven Website using PHP and MySQL." Then I ran into this paragraph in it.

 

While Web-based MySQL administration systems provide a convenient,

graphical interface for working with your MySQL databases, it is still import-

ant to learn the basics of MySQL?s command-line interface. The commands

you use in this interface are the very same commands you?ll have to include

in your PHP code later in this book. I therefore recommend going back to

Chapter 1 and installing MySQL on your own computer so you can complete

the exercises in this chapter before you get comfortable with your Web-based

administration interface.

Whichever method and operating system you use, you?ll end up at a command

prompt, ready to run the MySQL client program and connect to your MySQL

server. Here?s what you should type:

mysql -h hostname ?u username -p

You need to replace hostname with the host name or IP address of the computer

on which the MySQL server is running. If the client program is run on the same

computer as the server, you would use -h localhost or ?h 127.0.0.1, but in

this special case you can actually leave off this part of the command entirely.

username should be your MySQL user name. If you installed the MySQL server

yourself, this will just be root. If you?re using your Web host?s MySQL server,

this should be the MySQL user name the host assigned you.

 

Well I tried to open up terminal and type that command but everytime I do I get this :

-bash: mysql: command not found

What should I do? The graphical interface of the phpMyAdmin was something that I was picking pretty easy. Should I still learn to use a command line to access my MySQL database? If so, how do I do it from the Terminal Window.

 

Thanks for the help !! Carl..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...