简体   繁体   中英

i try to run mysql by command line

i try to mysql by cmd but

Microsoft Windows [Version 10.0.18363.900]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\xampp\mysql\bin>mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.4.11-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

What you did was open up a MySQL command prompt which is the first step.

From there, you would enter your SQL commands at the MariaDB [(none)]> prompt. You might do something like ( hit enter after each statement and always end statements with a semi colon ; ):

MariaDB [(none)]> use DATABASE_NAME_HERE;  -- Change to the right database
MariaDB [(none)]> SELECT `id` FROM `table`;  -- Run a select query
MariaDB [(none)]> UPDATE `table` SET `field` = 'value' WHERE `id` = 27;  -- Run an update query

Each of those commands would give you the results on screen.

You can run a single MySQL command right from the command line buy doing something like the following:

C:\xampp\mysql\bin>mysql -u root -p DATABASE_NAME_HERE -e "UPDATE `table` SET `field` = 'value' WHERE `id` = 27"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM