Using the MySQL Client


To follow along with the examples in this chapter, you will need to be familiar with using the MySQL client to access your database server. Although some graphical clients are available, this chapter uses the standard MySQL client available in both Windows and Unix distributions of the MySQL package.

To begin using MySQL and storing and retrieving data from the database server, you will need to log in to the server using the MySQL client. You can use the mysql command from a command prompt in Unix or Windows environments, as shown:

 [user@localhost]# mysql [-u<username> [-p] [-h<hostname>]] 

<username> is the username you use to access your database (if using the instructions found earlier in this section, the user name is "unleashed") and optionally <hostname> is the server name or IP address where the MySQL server is located. Usually the MySQL server resides on the same machine; for these circumstances, a hostname is not required and the default localhost will be used by the client. After you have executed the mysql command, you will be asked to enter your password and then you'll be brought to the MySQL console prompt:

 [user@localhost]# mysql -uunleashed -p Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 2 to server version: 4.0.12-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> 

At this point, you will now be able to use SQL commands to access the data that the account has access to.



PHP 5 Unleashed
PHP 5 Unleashed
ISBN: 067232511X
EAN: 2147483647
Year: 2004
Pages: 257

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net