search
HomeDatabaseMysql Tutorialmysql命令行导入sql文件到指定数据库的方法
mysql命令行导入sql文件到指定数据库的方法Jun 07, 2016 pm 03:15 PM
mysqlsqlCommand Lineimportdesignationdatabasedocumentmethod

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 第四章: ls 有一些我们常用的参数, 比如我们要知道当前目录的所有内容, 包括隐藏文件夹和文件和所有属性, 例 [root@AY130410135131135089 logs]# ls boot2013-06.log 使用 ls 命令的“-l”选项,则

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

 

  第四章:

  ls 有一些我们常用的参数, 比如我们要知道当前目录的所有内容, 包括隐藏文件夹和文件和所有属性, 例

  [root@AY130410135131135089 logs]# ls

  boot2013-06.log

  使用 ls 命令的“-l”选项,则结果以长模式输出:

  [root@AY130410135131135089 logs]# ls -l

  total 8

  -rw-rw-rw- 1 root root 5975 Jun 15 17:34 boot2013-06.log

  显示隐藏文件:

  [root@AY130410135131135089 logs]# ls -a

  . .. boot2013-06.log

  命令 选项 参数

  command -options arguments

  下面这个例子,ls 命令有两个选项, “l” 选项产生长格式输出,“t”选项按文件修改时间的先后来排序。

  [me@linuxbox ~]$ ls -lt

  确定一个文件什么文件类型我们用 file, 使用方法如下

  [root@AY130410135131135089 logs]# file boot2013-06.log

  boot2013-06.log: ASCII text

  [root@AY130410135131135089 assets]# file world.swf

  world.swf: Macromedia Flash data (compressed), version 10

  用 less 浏览文件内容

  [me@linuxbox ~]$ less /etc/passwd

  TODO 表 4-3: less 命令 需要截图哦。

  小提示:记得复制和粘贴技巧!如果你正在使用鼠标,双击文件名,来复制它,然后按下鼠标中键,粘贴文件名到命令行中。

  Symbolic Links符号链接

  Hard Links硬链接

  第五章:操作文件和目录

  cp ― 复制文件和目录

  mv ― 移动/重命名文件和目录

  mkdir ― 创建目录

  rm ― 删除文件和目录

  ln ― 创建硬链接和符号链接 TODO没搞懂 和Window快捷键的区别联系 点击打开链接

  cp ― 复制文件和目录

  jiangge@localhost:~$ cp item1 item2 # 把item复制到directory目录

  jiangge@localhost:~$ cp file1 file2 # 复制file1到file2

  jiangge@localhost:~$ cp -i file1 file2 # 复制过程中如果有这个文件提示是否覆盖

  jiangge@localhost:~$ cp dir1/* dir2 # 复制目录下所有文件或目录到目标目录

  jiangge@localhost:~$ cp -r dir1 dir2 # 递归复制

  mkdir ― 创建目录

  jiangge@localhost:~$ mkdir dir

  jiangge@localhost:~$ mkdir dir1 dir2 dir3 # 创建多个文件夹

  jiangge@localhost:~$ mkdir -p /dir1/dir2/dir3 # 递归创建文件夹

  mv ― 移动/重命名文件和目录

  jiangge@localhost:~$ mv file1 file2 # 重命名

  jiangge@localhost:~$ mv -i file1 file2 # 如果存在提示是否写入

  jiangge@localhost:~$ mv file1 file2 dir1 # 移动 file1 file2 至 dir1

  jiangge@localhost:~$ mv dir1 dir2 # 移动 dir1 至 dir2

  rm ― 删除文件和目录

  jiangge@localhost:~$ rm file1

  jiangge@localhost:~$ rm file1 dir1

  jiangge@localhost:~$ rm -r dir1 #删除文件夹, 递归删除

  jiangge@localhost:~$ rm -rf dir1 强制删除

  表5-3:通配符范例

  模式 匹配对象

  * 所有文件

  g* 文件名以“g”开头的文件

  b*.txt 以"b"开头,中间有零个或任意多个字符,并以".txt"结尾的文件

  Data??? 以“Data”开头,其后紧接着3个字符的文件

  [abc]* 文件名以"a","b",或"c"开头的文件

  BACKUP.[0-9][0-9][0-9] 以"BACKUP."开头,并紧接着3个数字的文件

  [[:upper:]]* 以大写字母开头的文件

  [![:digit:]]* 不以数字开头的文件

  *[[:lower:]123] 文件名以小写字母结尾,或以 “1”,“2”,或 “3” 结尾的文件

  表5-4:cp 选项

  选项 意义

  -a, --archive 复制文件和目录,以及它们的属性,包括所有权和权限。 通常,复本具有用户所操作文件的默认属性。

  -i, --interactive 在重写已存在文件之前,提示用户确认。如果这个选项不指定, cp 命令会默认重写文件。

  -r, --recursive 递归地复制目录及目录中的内容。当复制目录时, 需要这个选项(或者-a 选项)。

  -u, --update 当把文件从一个目录复制到另一个目录时,仅复制 目标目录中不存在的文件,或者是文件内容新于目标目录中已经存在的文件。

  -v, --verbose 显示翔实的命令操作信息

  表 5―5: cp 实例

  命令 运行结果

  cp file1 file2 复制文件 file1内容到文件 file2。如果 file2已经存在,file2的内容会被 file1的 内容重写。如果 file2不存在,则会创建 file2。

  cp -i file1 file2 这条命令和上面的命令一样,除了如果文件 file2存在的话,在文件 file2被重写之前, 会提示用户确认信息。

  cp file1 file2 dir1 复制文件 file1和文件 file2到目录 dir1。目录 dir1必须存在。

  cp dir1/* dir2 使用一个通配符,在目录 dir1中的所有文件都被复制到目录 dir2中。 dir2必须已经存在。

  cp -r dir1 dir2 复制目录 dir1中的内容到目录 dir2。如果目录 dir2不存在, 创建目录 dir2,操作完成后,目录 dir2中的内容和 dir1中的一样。 如果目录 dir2存在,则目录 dir1(和目录中的内容)将会被复制到 dir2中。

  第六章:点击打开链接

  type - 解读一个命令

  which - 显示哪些是可执行程序,which 确定一个可执行程序的位置

  man - 显示命令手册

  apropos - 显示一个合适的命令列表

  info - 显示一个命令信息

  whatis - 显示非常简短的描述一个命令

  alias - 为命令创建一个别名

  [shijiangge@localhost test]$ type type

  type is a shell builtin

  [shijiangge@localhost test]$ type ls

  ls is aliased to `ls --color=tty'

  [shijiangge@localhost test]$ type cp

  cp is hashed (/bin/cp)

  [shijiangge@localhost test]$ which ls #which 确定一个可执行程序的位置

  alias ls='ls --color=tty'

  /bin/ls

  [shijiangge@localhost test]$ which vim

  /usr/bin/vim

  help 获得帮助信息, 在每个shell命令的后面加上--help参数, 如

  [shijiangge@localhost test]$ ls --help

  Usage: ls [OPTION]... [FILE]...

  List information about the FILEs (the current directory by default).

  Sort entries alphabetically if none of -cftuvSUX nor --sort.

  [shijiangge@localhost test]$ help cd

  cd: cd [-L|-P] [dir]

  Change the current directory to DIR. The variable $HOME is the

  default DIR.

  [1] [2] [3] 

mysql命令行导入sql文件到指定数据库的方法

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
图文详解mysql架构原理图文详解mysql架构原理May 17, 2022 pm 05:54 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

mysql怎么替换换行符mysql怎么替换换行符Apr 18, 2022 pm 03:14 PM

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

mysql的msi与zip版本有什么区别mysql的msi与zip版本有什么区别May 16, 2022 pm 04:33 PM

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

mysql怎么去掉第一个字符mysql怎么去掉第一个字符May 19, 2022 am 10:21 AM

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

mysql怎么将varchar转换为int类型mysql怎么将varchar转换为int类型May 12, 2022 pm 04:51 PM

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

MySQL复制技术之异步复制和半同步复制MySQL复制技术之异步复制和半同步复制Apr 25, 2022 pm 07:21 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

带你把MySQL索引吃透了带你把MySQL索引吃透了Apr 22, 2022 am 11:48 AM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

mysql怎么判断是否是数字类型mysql怎么判断是否是数字类型May 16, 2022 am 10:09 AM

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor