简体   繁体   English

我尝试通过命令行运行 mysql

[英]i try to run mysql by command line

i try to mysql by cmd but我尝试通过 cmd 来 mysql 但是

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.您所做的是打开 MySQL 命令提示符,这是第一步。

From there, you would enter your SQL commands at the MariaDB [(none)]> prompt.从那里,您将在MariaDB [(none)]>提示符下输入 SQL 命令。 You might do something like ( hit enter after each statement and always end statements with a semi colon ; ):您可能会执行类似的操作(在每个语句后按Enter并始终以分号结束语句 ):

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:您可以直接从命令行购买运行单个 MySQL 命令,执行如下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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