Learning Mysql



Download 4.24 Mb.
View original pdf
Page92/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   88   89   90   91   92   93   94   95   ...   366
Learning 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 book 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 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 inset 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 |
+----------+
96 | Chapter 3:
Using the MySQL Monitor


| mysql |
| test |
+----------+
2 rows inset sec)
You may see different results on your MySQL server. There are two databases here the mysql database is used to store information about user access privileges, and the test database is an empty scratch space for experimentation. Not terribly exciting, but you’ll remedy this situation as you progress through this book!

Download 4.24 Mb.

Share with your friends:
1   ...   88   89   90   91   92   93   94   95   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page