首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mysql连接配置文件配置文件

mysql连接配置文件配置文件
EN

Stack Overflow用户
提问于 2011-09-28 16:01:24
回答 1查看 380关注 0票数 2

有没有办法将连接参数(如主机、端口、用户名、密码、数据库)作为快捷方式保存到我经常访问的mysql服务器上?

我正在寻找一些类似于ssh config的mysql从终端在ubuntu。优选地,还具有ssh隧道支持。

EN

回答 1

Stack Overflow用户

发布于 2011-09-28 16:50:13

您可以将--defaults file选项与shell别名结合使用,例如:

代码语言:javascript
复制
% 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>

因此,您可以创建具有不同设置的不同文件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7580036

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档