简体   繁体   English

MySQL通过SSH + Bash错误

[英]MySQL via SSH + Bash error

ssh root@162.243.67.60 mysql -uroot -p --execute="grant all privileges on wordpress.* to 'firaswp'@'54.89.73.129' identified by 'password'" ssh root@162.243.67.60 mysql -uroot -p --execute =“将wordpress。*上的所有特权授予'firaswp'@'54.89.73.129',由'password'标识”

it doesn't give me syntax error but instead gives a really weird output. 它没有给我语法错误,但是却给出了一个非常奇怪的输出。 Been trying to get mysql to run the grant privilege option via SSH for 1-2 days now and I still can't figure it out. 一直试图让mysql通过SSH运行1-2天的授予特权选项,但我仍然无法弄清楚。 This isn't the primary line that I want - I actually want to input the IP as a variable inside a script but first, I figure I would get it to work normally.. any help would be appreciated! 这不是我想要的主要内容-实际上我想在脚本中输入IP作为变量,但是首先,我认为我可以使其正常工作..任何帮助将不胜感激! The output is below. 输出如下。

mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 Copyright (c) 2000, 2013, Oracle and/or its affiliates. 适用于redhat-linux-gnu(x86_64)的mysql Ver 14.14 Distrib 5.1.73,使用readline 5.1版权所有(c)2000、2013,Oracle和/或其分支机构。 All rights reserved. 版权所有。

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Oracle是Oracle Corporation和/或其分支机构的注册商标。 Other names may be trademarks of their respective owners. 其他名称可能是其各自所有者的商标。

Usage: mysql [OPTIONS] [database] -?, --help Display this help and exit. 用法:mysql [OPTIONS] [database]-?, --help显示此帮助并退出。 -I, --help Synonym for -? -I,--help是-的同义词? --auto-rehash --auto-翻版
Enable automatic rehashing. 启用自动重新哈希处理。 One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. 不需要使用“重新哈希”来完成表和字段,但是启动和重新连接可能需要更长的时间。 Disable with --disable-auto-rehash. 使用--disable-auto-hash禁用。 -A, --no-auto-rehash No automatic rehashing. -A,--no-auto-rehash没有自动重新哈希。 One has to use 'rehash' to get table and field completion. 必须使用“重新哈希”来获得表和字段的完成。 This gives a quicker start of mysql and disables rehashing on reconnect. 这样可以更快地启动mysql,并在重新连接时禁用重新哈希。 -B, --batch Don't use history file. -B,--batch不使用历史文件。 Disable interactive behavior. 禁用交互行为。 (Enables --silent.) --character-sets-dir=name Directory for character set files. (启用--silent。)--character-sets-dir = name字符集文件的目录。 --column-type-info Display column type information. --column-type-in​​fo显示列类型信息。 -c, --comments Preserve comments. -c,--comments保留注释。 Send comments to the server. 将评论发送到服务器。 The default is --skip-comments (discard comments), enable with --comments. 默认值为--skip-comments(丢弃注释),使用--comments启用。 -C, --compress Use compression in server/client protocol. -C,--compress在服务器/客户端协议中使用压缩。 -#, --debug[=#] This is a non-debug version. -#,--debug [=#]这是非调试版本。 Catch this and exit. 赶上并退出。 --debug-check Check memory and open file usage at exit. --debug-check在出口检查内存并打开文件使用情况。 -T, --debug-info Print some debug info at exit. -T,--debug-info在出口处打印一些调试信息。 -D, --database=name Database to use. -D,--database = name要使用的数据库。
--default-character-set=name Set the default character set. --default-character-set = name设置默认字符集。 --delimiter=name Delimiter to be used. --delimiter = name要使用的分隔符。 -e, --execute=name Execute command and quit. -e,--execute = name执行命令并退出。 (Disables --force and history file.) -E, --vertical Print the output of a query (rows) vertically. (禁用--force和历史文件。)-E,--vertical垂直打印查询(行)的输出。 -f, --force Continue even if we get an SQL error. -f,--force即使出现SQL错误,也继续。 -G, --named-commands Enable named commands. -G,--named-commands启用命名命令。 Named commands mean this program's internal commands; 命名命令表示该程序的内部命令。 see mysql> help . 参见mysql> help。 When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. 启用后,可以在查询的任何行中使用命名命令,否则只能在回车之前的第一行中使用。 Disable with --disable-named-commands. 使用--disable-named-commands禁用。 This option is disabled by default. 默认情况下禁用此选项。 -g, --no-named-commands Named commands are disabled. -g,--no-named-commands禁用命名命令。 Use * form only, or use named commands only in the beginning of a line ending with a semicolon (;). 仅使用*形式,或仅在以分号(;)结尾的行的开头使用命名命令。 Since version 10.9, the client now starts with this option ENABLED by default. 从版本10.9开始,客户端现在默认启用此选项。 Disable with '-G'. 禁用“ -G”。 Long format commands still work from the first line. 长格式命令仍然从第一行开始工作。 WARNING: option deprecated; 警告:不建议使用该选项; use --disable-named-commands instead. 请改用--disable-named-commands。 -i, --ignore-spaces Ignore space after function names. -i,--ignore-spaces忽略函数名称后的空格。 --local-infile Enable/disable LOAD DATA LOCAL INFILE. --local-infile启用/禁用LOAD DATA LOCAL INFILE。 -b, --no-beep Turn off beep on error. -b,--no-beep关闭错误提示音。 -h, --host=name Connect to host. -h,--host = name连接到主机。 -H, --html -H,--html
Produce HTML output. 产生HTML输出。 -X, --xml Produce XML output. -X,--xml生成XML输出。
--line-numbers Write line numbers for errors. --line-numbers写入行号以获取错误。 -L, --skip-line-numbers Don't write line number for errors. -L,--skip-line-numbers不要为错误写行号。 -n, --unbuffered Flush buffer after each query. -n,--unbuffered每次查询后刷新缓冲区。 --column-names Write column names in results. --column-names在结果中写入列名。 -N, --skip-column-names Don't write column names in results. -N,--skip-column-names不要在结果中写入列名。 -O, --set-variable=name Change the value of a variable. -O,--set-variable = name更改变量的值。 Please note that this option is deprecated; 请注意,此选项已被弃用。 you can set variables directly with --variable-name=value. 您可以使用--variable-name = value直接设置变量。 --sigint-ignore Ignore SIGINT (CTRL-C). --sigint-ignore忽略SIGINT(CTRL-C)。 -o, --one-database Ignore statements except those that occur while the default database is the one named at the command line. -o,--one-database忽略语句,但默认数据库是在命令行中命名的语句除外。 --pager[=name] Pager to use to display results. --pager [= name]用于显示结果的寻呼机。 If you don't supply an option, the default pager is taken from your ENV variable PAGER. 如果您不提供选项,则默认寻呼机将从您的ENV变量PAGER中获取。 Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. 有效的传呼机越来越少,等等[>文件名]等。另请参见交互式帮助(\\ h)。 This option does not work in batch mode. 此选项在批处理模式下不起作用。 Disable with --disable-pager. 使用--disable-pager禁用。 This option is disabled by default. 默认情况下禁用此选项。 --no-pager Disable pager and print to stdout. --no-pager禁用寻呼机并打印到标准输出。 See interactive help (\\h) also. 另请参见交互式帮助(\\ h)。 WARNING: option deprecated; 警告:不建议使用该选项; use --disable-pager instead. 使用--disable-pager代替。 -p, --password[=name] Password to use when connecting to server. -p,--password [= name]连接服务器时使用的密码。 If password is not given it's asked from the tty. 如果未提供密码,则从tty询问。 -P, --port=# Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306). -P,--port =#用于连接的端口号,或默认为0(默认为my.cnf,$ MYSQL_TCP_PORT,/ etc / services,内置默认值(3306))。 --prompt=name Set the mysql prompt to this value. --prompt = name设置mysql提示符为该值。 --protocol=name The protocol to use for connection (tcp, socket, pipe, memory). --protocol = name用于连接的协议(TCP,套接字,管道,内存)。 -q, --quick Don't cache result, print it row by row. -q,--quick不缓存结果,逐行打印。 This may slow down the server if the output is suspended. 如果输出被挂起,这可能会降低服务器的速度。 Doesn't use history file. 不使用历史记录文件。 -r, --raw Write fields without conversion. -r,--raw无需转换即可写入字段。 Used with --batch. 与--batch一起使用。 --reconnect Reconnect if the connection is lost. --reconnect如果连接丢失,请重新连接。 Disable with --disable-reconnect. 使用--disable-reconnect禁用。 This option is enabled by default. 默认情况下启用此选项。 -s, --silent Be more silent. -s,--silent保持沉默。 Print results with a tab as separator, each row on new line. 用制表符作为分隔符打印结果,每行新行。 -S, --socket=name The socket file to use for connection. -S,--socket = name用于连接的套接字文件。 --ssl Enable SSL for connection (automatically enabled with other flags).Disable with --skip-ssl. --ssl启用SSL进行连接(通过其他标志自动启用)。使用--skip-ssl禁用。 --ssl-ca=name CA file in PEM format (check OpenSSL docs, implies --ssl). --ssl-ca = name PEM格式的CA文件(检查OpenSSL文档,暗含--ssl)。 --ssl-capath=name CA directory (check OpenSSL docs, implies --ssl). --ssl-capath =名称CA目录(检查OpenSSL文档,暗含--ssl)。 --ssl-cert=name X509 cert in PEM format (implies --ssl). --ssl-cert = name PEM格式的X509证书(意味着--ssl)。 --ssl-cipher=name SSL cipher to use (implies --ssl). --ssl-cipher = name要使用的SSL密码(意味着--ssl)。 --ssl-key=name X509 key in PEM format (implies --ssl). --ssl-key = name PEM格式的X509密钥(意味着--ssl)。 --ssl-verify-server-cert Verify server's "Common Name" in its cert against hostname used when connecting. --ssl-verify-server-cert针对连接时使用的主机名,验证其证书中服务器的“公用名”。 This option is disabled by default. 默认情况下禁用此选项。 -t, --table Output in table format. -t,--table以表格式输出。 --tee=name Append everything into outfile. --tee = name将所有内容附加到输出文件中。 See interactive help (\\h) also. 另请参见交互式帮助(\\ h)。 Does not work in batch mode. 在批处理模式下不起作用。 Disable with --disable-tee. 使用--disable-tee禁用。 This option is disabled by default. 默认情况下禁用此选项。 --no-tee Disable outfile. --no-tee禁用输出文件。 See interactive help (\\h) also. 另请参见交互式帮助(\\ h)。 WARNING: Option deprecated; 警告:不建议使用该选项; use --disable-tee instead. 使用--disable-tee代替。 -u, --user=name User for login if not current user. -u,--user = name如果不是当前用户,则为登录用户。 -U, --safe-updates Only allow UPDATE and DELETE that uses keys. -U,--safe-updates仅允许使用键的UPDATE和DELETE。 -U, --i-am-a-dummy Synonym for option --safe-updates, -U. -U,-i-am-a-dummy选项--safe-updates,-U的同义词。 -v, --verbose Write more. -v,--verbose写更多。 (-v -v -v gives the table output format). (-v -v -v给出表的输出格式)。 -V, --version Output version information and exit. -V,--version输出版本信息并退出。 -w, --wait Wait and retry if connection is down. -w,--wait等待并在连接断开时重试。 --connect_timeout=# Number of seconds before connection timeout. --connect_timeout =#连接超时之前的秒数。 --max_allowed_packet=# The maximum packet length to send to or receive from server. --max_allowed_pa​​cket =#要发送到服务器或从服务器接收的最大数据包长度。 --net_buffer_length=# The buffer size for TCP/IP and socket communication. --net_buffer_length =#TCP / IP和套接字通信的缓冲区大小。 --select_limit=# Automatic limit for SELECT when using --safe-updates. --select_limit =#使用--safe-updates时SELECT的自动限制。 --max_join_size=# Automatic limit for rows in a join when using --safe-updates. --max_join_size =#使用--safe-updates时联接中行的自动限制。 --secure-auth Refuse client connecting to server if it uses old (pre-4.1.1) protocol. --secure-auth如果客户端使用旧的(4.1.1之前)协议,则拒绝客户端连接。 --server-arg=name Send embedded server this as a parameter. --server-arg = name将其作为参数发送给嵌入式服务器。 --show-warnings Show warnings after every statement. --show-warnings在每个语句后显示警告。

Default options are read from the following files in the given order: /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf The following groups are read: mysql client The following options may be given as the first argument: --print-defaults Print the program argument list and exit. 默认选项是按照给定的顺序从以下文件中读取的:/etc/mysql/my.cnf /etc/my.cnf〜/ .my.cnf读取以下组:mysql client以下选项可以作为第一个选项参数:--print-defaults打印程序参数列表并退出。 --no-defaults Don't read default options from any option file. --no-defaults不从任何选项文件中读取默认选项。 --defaults-file=# Only read default options from the given file #. --defaults-file =#仅从给定文件#中读取默认选项。 --defaults-extra-file=# Read this file after the global files are read. --defaults-extra-file =#在读取全局文件后读取此文件。

Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ----------------------------- auto-rehash TRUE character-sets-dir 变量(--variable-name = value)和布尔选项{FALSE | TRUE}值(读取选项之后)-------------------------- ------- -----------------------------自动重新编码TRUE character-sets-dir
(No default value) column-type-info FALSE comments (无默认值)column-type-in​​fo FALSE注释
FALSE compress FALSE debug-check FALSE compress FALSE调试检查
FALSE debug-info FALSE database FALSE调试信息FALSE数据库
(No default value) default-character-set latin1 delimiter ; (无默认值)default-character-set latin1定界符; vertical FALSE force 垂直假力
FALSE named-commands FALSE ignore-spaces FALSE命名命令FALSE忽略空间
FALSE local-infile FALSE no-beep FALSE本地文件内FALSE无提示
FALSE host (No default value) html FALSE主机(无默认值)html
FALSE xml FALSE line-numbers FALSE xml FALSE行号
TRUE unbuffered FALSE column-names TRUE无缓冲FALSE列名
TRUE sigint-ignore FALSE port 真sigint-ignore FALSE端口
0 prompt mysql> quick 0提示mysql>快速
FALSE raw FALSE reconnect FALSE原始FALSE重新连接
FALSE socket (No default value) ssl FALSE套接字(无默认值)ssl
FALSE ssl-ca (No default value) ssl-capath (No default value) ssl-cert (No default value) ssl-cipher (No default value) ssl-key FALSE ssl-ca(无默认值)ssl-capath(无默认值)ssl-cert(无默认值)ssl-cipher(无默认值)ssl-key
(No default value) ssl-verify-server-cert FALSE table (无默认值)ssl-verify-server-cert FALSE表
FALSE user root safe-updates FALSE用户root安全更新
FALSE i-am-a-dummy FALSE connect_timeout 虚假我是虚拟的虚假connect_timeout
0 max_allowed_packet 16777216 net_buffer_length 0 max_allowed_pa​​cket 16777216 net_buffer_length
16384 select_limit 1000 max_join_size 16384 select_limit 1000 max_join_size
1000000 secure-auth FALSE show-warnings 1000000个安全认证的FALSE显示警告
FALSE

  1. Your syntax for the mysql command is wrong. 您的mysql命令语法错误。 I think you need to leave a space between -uroot ie -u root 我认为您需要在-uroot之间留一个空格,即-u root
  2. Why not break the command down into multiple steps ie 为什么不将命令分解为多个步骤,即

     $ssh root@162.243.67.60 $mysql -u root -p mysql> grant all privileges on wordpress.* to 'firaswp'@'54.89.73.129' identified by 'password' 

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

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