mysql在命令行中,指定要连接的数据库?
需求描述:
mysql客户端,可以在登录到mysql数据库时,指定要连接到哪个数据库
这里进行一个测试。
测试过程:
1.mysql通过-D参数指定连接到test数据库
[mysql@redhat6 scripts]$ mysql -uroot -p -D test
Enter password:
ERROR (): Access denied for user 'root'@'localhost' (using password: YES)
[mysql@redhat6 scripts]$ mysql -uroot -p -D test
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5.-log MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select database();
+------------+
| database() |
+------------+
| test |
+------------+
row in set (0.00 sec)
备注:通过在-D参数后面指定数据库名字,就连接到了test数据库。
2.通过-D参数,连接到test01数据库
[mysql@redhat6 scripts]$ mysql -uroot -p -D test01
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5.-log MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select database();
+------------+
| database() |
+------------+
| test01 |
+------------+
row in set (0.00 sec) mysql>
备注:通过在-D参数后面指定数据库名字,就连接到了test01数据库。
小结:通过-D 参数指明要直接连接到哪个数据库。
文档创建时间:2018年3月20日11:37:27
mysql在命令行中,指定要连接的数据库?的更多相关文章
- Windows命令行中使用SSH连接Linux
转自 http://www.linuxidc.com/Linux/2014-02/96625.htm 1.下载: openssh for Winodws: 免费下载地址在 http://linux.l ...
- mysql中如何在命令行中,执行一个SQL脚本文件?
需求描述: 在mysql数据库的使用中,有的时候,需要直接在shell的命令行中,执行某个SQL脚本文件, 比如,要初始化数据库,创建特定的存储过程,创建表等操作,这里进行一个基本的测试. 一般情况, ...
- 转 mysql mysql命令行中执行sql的几种方式总结
https://www.jb51.net/article/96394.htm 1.直接输入sql执行 MySQL> select now(); +---------------------+ | ...
- 命令行中mysql乱码问题
1.现象 在命令行中,执行sql语句如果包含中问题,提示“ Data too long for column '列名' at row 1” 或者在命令行中查询出的结果中,中文乱码 2.分析 ...
- Mysql常用命令行大全(三)
/**操作数据库*/ SHOW DATABASES; CREATE DATABASE db; SHOW DATABASES; DROP DATABASE db; /**操作表*/ USE db; S ...
- php开发面试题---Mysql常用命令行大全
php开发面试题---Mysql常用命令行大全 一.总结 一句话总结: 常见关键词:create,use,drop,insert,update,select,where ,from.inner joi ...
- 命令行中使用adb安装apk
转载:http://blog.sina.com.cn/s/blog_8324d8e80101b8dn.html 在你的android—IDE中找到D:\Softwave_Ghost\技术软件\IDE\ ...
- 在 Linux/windows下 命令行中使用和执行 PHP 代码[交互式php]
[注释]在ubuntu下,升级php到7.1版本,虽然提示的是Interactive mode enabled, 但实际上可以直接书写命令,和interactive shell效果一样. 一:wind ...
- (转)Mysql常用命令行
原文:http://www.cnblogs.com/TsengYuen/archive/2012/01/11/2319034.html Mysql常用命令行 Mysql经常使用号令行大全 熬头招.my ...
随机推荐
- ClickAndMoveTest
关于ccTouchesEnded看这个博客即可 http://blog.linguofeng.com/archive/2012/09/12/cocos2d-x-touch.html class Cli ...
- ILRewrite && how to write a profiler
Rewrite MSIL Code on the Fly with the .NET Framework Profiling API http://clrprofiler.codeplex.com/ ...
- I/O Completion Ports
http://weblogs.asp.net/kennykerr/parallel-programming-with-c-part-4-i-o-completion-ports http://webl ...
- 【转】服务器添加新用户用ssh-key 登录,并禁用root用户 密码登录
[转]Linux最高权限用户root,默认可以直接登录sshd.为了提高服务器的安全度,需要对它进行禁止,使得攻击者无法通过暴力破解来获取root权限. ps: 以下内容皆非原创,只是个人的一个实践 ...
- singer页左侧滚动的时候右侧跟随高亮显示
1.封装scroll.vue的listenScroll属性和方法,用来确定监听listview.vue的滚动事件 2.将listview.vue的listenScroll属性默认设置为true; 3. ...
- 【转】MySQL索引原理及慢查询优化
MySQL凭借着出色的性能.低廉的成本.丰富的资源,已经成为绝大多数互联网公司的首选关系型数据库.虽然性能出色,但所谓“好马配好鞍”,如何能够更好的使用它,已经成为开发工程师的必修课,我们经常会从职位 ...
- strcat
将两个char类型链接. char d[20]="GoldenGlobal"; char *s="View"; strcat(d,s); 结果放在d中 prin ...
- 【Unity笔记】检测当前的运行平台
// 判断当前运行平台为Android平台时 if (Application.platform == RuntimePlatform.Android) { if (Input.GetKeyDown(K ...
- Spring 网路搜集的情报
Spring Validate http://haohaoxuexi.iteye.com/blog/1812584
- Nginx实战系列之功能篇----后端节点健康检查(转)
公司前一段对业务线上的nginx做了整理,重点就是对nginx上负载均衡器的后端节点做健康检查.目前,nginx对后端节点健康检查的方式主要有3种,这里列出: 1.ngx_http_proxy_m ...