有没有办法将连接参数(如主机、端口、用户名、密码、数据库)作为快捷方式保存到我经常访问的mysql服务器上?
我正在寻找一些类似于ssh config的mysql从终端在ubuntu。优选地,还具有ssh隧道支持。
发布于 2011-09-28 16:50:13
您可以将--defaults file选项与shell别名结合使用,例如:
% cat db01
[mysql]
user=root
password=<your_pwd>
host=<your_host>
% alias my_db01='mysql --defaults-file=db01'
% my_db01
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>因此,您可以创建具有不同设置的不同文件。
https://stackoverflow.com/questions/7580036
复制相似问题