Learning Mysql


MySQL Monitor Program Options | 103



Download 4.24 Mb.
View original pdf
Page98/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   94   95   96   97   98   99   100   101   ...   366
Learning MySQL
MySQL Monitor Program Options | 103

view running processes. However, the password maybe stored in your command- line history, which other users maybe able to access.
database
The database to use. This saves you from having to type USE
the_database_name
after the MySQL monitor starts. You can also simply omit the database option and just add the name of the database you want to use at the end of the mysql command.
safe-updates
Most experienced MySQL users can remember occasions where they’ve accidentally deleted all the data in a table by issuing a DELETE FROM table_name
command,
forgetting to add a limiting condition.
The safe-updates option prevents you from doing this by requiring you to provide a key constraint to
DELETE
and UPDATE, or to use a
LIMIT
clause. For example:
mysql> DELETE FROM user;
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
We’ll explain these commands in later chapters.
Let’s look at a couple of examples. First, let’s say you want to connect to the server running on the same machine you’re working on (
localhost
), as the MySQL user root, and with the password
the_mysql_root_password
. You want to use the database music, so you would type mysql --user=root --password=the_mysql_root_password --database=music
Now fora more complex example say you’re working on the host sadri.learning-
mysql.com, and wish to use the
Moodle database on the MySQL server listening to port on the host zahra.learningmysql.com. For this MySQL server, you have the
MySQL account name moodleuser and the password moodlepass
. You would type the command (all on one line mysql \
--host=zahra.learningmysql.com \
-port \
--user=moodleuser \

Download 4.24 Mb.

Share with your friends:
1   ...   94   95   96   97   98   99   100   101   ...   366




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

    Main page