mysql命令行导入sql文件到指定数据库的方法
欢迎进入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]

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

Steps to automatically back up MySQL data using Navicat: Install and connect to the MySQL server. Create a backup task, specifying the backup source, file location, and name. Configure backup options, including backup type, frequency, and retention time. Set up an automatic backup plan, enable automatic backup, set time and frequency. Preview the backup settings and perform the backup. Monitor backup progress and history.

How to solve the MySQL "Access denied for user" error: 1. Check the user's permission to connect to the database; 2. Reset the password; 3. Allow remote connections; 4. Refresh permissions; 5. Check the database server configuration (bind-address, skip-grant-tables); 6. Check the firewall rules; 7. Restart the MySQL service. Tip: Make changes after backing up the database.
