Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Powershell:将查询转换为字符串_Mysql_String_Powershell_Mariadb - Fatal编程技术网

Mysql Powershell:将查询转换为字符串

Mysql Powershell:将查询转换为字符串,mysql,string,powershell,mariadb,Mysql,String,Powershell,Mariadb,你能帮我把下面的查询转换成字符串$query吗 $arg1 = "--user=root" $arg2 = "--password=" + $dbPsw 或是泼洒。 Mysql只返回命令列表 非常感谢我认为您不需要启动流程。只需运行命令。(毕竟,PowerShell是一个shell。shell的任务之一是运行您输入的命令。) 需要注意的一点是,后引号(`)字符是PowerShell中的转义字符,因此您必须将其加倍: mysql "--user=root" "--password=$dbPsw

你能帮我把下面的查询转换成字符串$query吗

$arg1 = "--user=root" 
$arg2 = "--password=" + $dbPsw
或是泼洒。 Mysql只返回命令列表


非常感谢

我认为您不需要启动流程。只需运行命令。(毕竟,PowerShell是一个shell。shell的任务之一是运行您输入的命令。)

需要注意的一点是,后引号(`)字符是PowerShell中的转义字符,因此您必须将其加倍:

mysql "--user=root" "--password=$dbPsw" "--execute=INSERT INTO ``characters`` (``account_name``,``obj_id``,``char_name``,``phone``) VALUES ('John',1000,'John',1234567890);"
如果
mysql
命令不在路径中,则需要指定其路径;e、 g:

C:\MYSQL\mysql "--user=root" ...
如果
mysql.exe
程序位于包含空白的路径中,请使用调用(
&
)操作符;e、 g:

& "C:\Program Files\MYSQL\mysql.exe" "--user=root" ...

嗨,比尔,我也有同样的问题。如图所示,“a”字母为黄色,输出控制台如下:输出中没有“a”字母。Mysql返回错误1064(42000):|抱歉,忘记了反引号。更新了我的答案。谢谢比尔的回溯解释。作品
C:\MYSQL\mysql "--user=root" ...
& "C:\Program Files\MYSQL\mysql.exe" "--user=root" ...