2 Star 4 Fork 2

晴云孤魂/shell-scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
wmysql.sh 907 Bytes
一键复制 编辑 原始数据 按行查看 历史
晴云孤魂 提交于 2022-10-08 03:55 +08:00 . Fixed files:prevent word splitting
wmysql() {
#在mintty中使用Windows版MySQL的命令行链接Windows MySQL主机
#需要此函数原因是使用Cygwin版本的mysql连接到Windows mysqld后无法输入和粘贴中文;
local apppath="D:\UPUPW_ANK_W64\Modules\MySQL\bin\mysql.exe"
[ ! -z "$MYSQLBIN" ] && apppath="$MYSQLBIN" ## 环境变量存在值则使用环境变量作为mysql.exe路径
if [ -e "${apppath}" ];then
#`cygpath -au "$apppath"` $@
`cygpath -au "$apppath"` --default-character-set=utf8mb4 "$@"
else
local MySQLDBIN=$(wmicps mysqld.exe 2>/dev/null|dos2unix -q|iconv -f GBK -t utf-8|awk -F '=' '/ExecutablePath=/{sub($1"=","");print $0;exit;}')
if [ -e "$MySQLDBIN" ];then
`cygpath -au "${MySQLDBIN/mysqld.exe/mysql.exe}"` "$@"
return
fi
echo -e "program not found!\npath:${apppath//\\/\\\\} "
fi
}
alias wmysql2='wmysql -h127.0.0.1 -uroot -proot'
alias wmysqluser='wmysql2'
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/hexiyou/shell-scripts.git
git@gitee.com:hexiyou/shell-scripts.git
hexiyou
shell-scripts
shell-scripts
master

搜索帮助