Databases Reference
In-Depth Information
If you get a message from the operating system saying that it can't find the MySQL
program, you'll need to specify the full path to the mysql executable file as discussed in
“Error Message About MySQL Executable Programs Not Being Found or Recognized.”
If you used a nonstandard socket file when starting your server, you'll need to provide
the details to any MySQL client programs you run, including mysql . For example, you
might type:
$ mysql \
--socket=server_socket \
--user=root \
--password= the_mysql_root_password
If you're trying to connect to a MySQL server on a different computer or a nonstandard
port, you should specify these when starting the monitor:
$ mysql \
--host=server_host_name \
--port=server_port \
--user=root \
--password= the_mysql_root_password
We list a few more options to the monitor program at the end of this chapter.
Most of the other MySQL programs we'll describe in this topic take the same port and
socket options to identify the server to connect to, and the same user and password
options to identify and authenticate the MySQL user.
If all goes well, you'll get the monitor's mysql> prompt:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 456 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
You can now type in commands that MySQL understands. To start things off, ask the
server what version of MySQL it is:
mysql> SELECT VERSION();
+------------+
| VERSION() |
+------------+
| 5.0.22 |
+------------+
1 row in set (0.03 sec)
You'll almost certainly be using a different version number from the one we're using.
Now ask the server to list all the databases that it has:
mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
 
Search WWH ::




Custom Search