1.windows自带命令进入mysql所在磁盘
 
2.进入mysql安装目录的bin文件
D:\>cd D:\Program Files (x86)\mysql-5.5.25-winx64\bin
 
3.登录mysql数据库
D:\Program Files (x86)\mysql-5.5.25-winx64\bin>mysql.exe -uroot -p123456 -h127.0.0.1 -P3306
 
接下来之后就可以操作mysql数据库了
 
mysql创建数据库指定字符集
CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
 
重启tomcat
/opt/appstack/ctlscript.sh restart tomcat
 
导出数据库的命令行:
mysqldump -u 数据库用户名 -p 数据库名称 > 导出的数据库文件
         实例:mysqldump -u root -p db1>g:\liongg.sql (把数据库db1 导出到 liongg.sql 文件中)
         回车之后,会提示输入密码,有则输入无则直接回车,片刻即可成功。
 
导出整个数据库
mysqldump -u用户名 -p密码 -hIP -P端口号 数据库名 --hex-blob>D:\mysqldump_dir\liongg.sql
 
只导出数据库表结构
mysqldump -u用户名 -p密码 -hIP -P端口号 数据库名 --opt -d>D:\mysqldump_dir\liongg_ddl.sql
 
只导出数据库表数据
mysqldump -u用户名 -p密码 -hIP -P端口号 数据库名 -t>D:\mysqldump_dir\liongg_dml.sql
 
 
导入数据库的命令行:
1.mysql -u 数据库用户名 –p 数据库名称 < 导入的数据库文件
         实例:mysqldump -u root -p db2<g:\liongg.sql; (已新建数据库db2,把liongg.sql导入)
2.先登录数据库,use database ;然后使用source sql文件路径就可以导入了。
3.导入数据库mysqlimport -u root -p123456 < g:\liongg.sql;
 
 
mysql允许远程连接,设置权限
grant 权限 on 数据库名.表名 to '用户名'@'IP地址' identified by '密码' with grant option;
grant all privileges *.* to 'root'@'%' identified by '123456' with grant option;
 
revoke 权限 on 数据库名.表名 from '用户名'@'IP地址';
revoke all privileges *.* from 'root'@'%';
 
 
window dos命令
md mysqldump_dir   创建文件夹
ECHO 文件内容>文件名.txt  创建文件
ECHO 文件内容追加入>>文件名.txt  创建文件
copy con 文件名
然后输入文件内容后按ctrl+z结束,文件就建立了
 
del 只能删除同一文件夹的文件
rd /s 文件夹名  可以删除文件夹及文件夹里面的所以东西
 
 
linux dos命令
man 提示命令
mkdir mysqldump_dir   创建文件夹
touch 文件名.txt  创建文件
 
 
rm 只能删除同一文件夹的文件
rm -r 文件夹名  可以删除文件夹及文件夹里面的所以东西(r代表递归)
 
gz命令文件处理
压缩:tar -zcvf FileName.tar.gz 路径/压缩文件名
解压:tar -zxvf 路径/FileName.tar.gz
 
vim  查看文件
/关键字  查找文件 按 n 查找下一处,按 N 查找上一处
从第一行到最后一行,把utf8mb4替换成utf8   :1:$ s/utf8mb4/utf8/g    或   :g/utf8mb4/s//utf8/g
vim查看文件之后按 i 编辑文件,按esc退出编辑
 
给文件夹赋权限
chown -R tomcat:tomcat  /opt/files
 
 

[root@VM_64_7_centos tmp]# id
uid=0(root) gid=0(root) groups=0(root)
[root@VM_64_7_centos tmp]# id test
id: test: no such user
[root@VM_64_7_centos tmp]# id root
uid=0(root) gid=0(root) groups=0(root)
[root@VM_64_7_centos tmp]# useradd test
[root@VM_64_7_centos tmp]# id
uid=0(root) gid=0(root) groups=0(root)
[root@VM_64_7_centos tmp]# id test
uid=1000(test) gid=1000(test) groups=1000(test)
[root@VM_64_7_centos tmp]# gpasswd -a test root
Adding user test to group root
[root@VM_64_7_centos tmp]# id test
uid=1000(test) gid=1000(test) groups=1000(test),0(root)
[root@VM_64_7_centos tmp]# gpasswd -d test root
Removing user test from group root
[root@VM_64_7_centos tmp]# id test
uid=1000(test) gid=1000(test) groups=1000(test)
[root@VM_64_7_centos ~]# passwd test
Changing password for user test.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[test@VM_64_7_centos tmp]$ id
uid=1000(test) gid=1000(test) groups=1000(test)
[test@VM_64_7_centos tmp]$ su - root
Password:
[root@VM_64_7_centos tmp]# id
uid=0(root) gid=0(root) groups=0(root)
[root@VM_64_7_centos tmp]#
[root@VM_64_7_centos tmp]# userdel -r test
[root@VM_64_7_centos tmp]# id test
id: test: no such user

[root@VM_64_7_centos tmp]# ls -l
total 8
-r--r--r-- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod g+w o+x ./test.sh
chmod: cannot access 'o+x': No such file or directory
[root@VM_64_7_centos tmp]# chmod g+w ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-r--rw-r-- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod u+wx ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-rwxrw-r-- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod o+x ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-rwxrw-r-x 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod a-rwx ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
---------- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod u+rwx ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-rwx------ 1 root root 616 Dec 18 13:48 test.sh

[root@VM_64_7_centos tmp]# ls -l
total 8
-rwx------ 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod 000 ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
---------- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod u+001 ./test.sh
chmod: invalid mode: 'u+001'
Try 'chmod --help' for more information.
[root@VM_64_7_centos tmp]# chmod 001 ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
---------x 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod 020 ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-----w---- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod 400 ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-r-------- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod 600 ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-rw------- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod 700 ./test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-rwx------ 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# chmod 744 test.sh
[root@VM_64_7_centos tmp]# ls -l
total 8
-rwxr--r-- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]#

[root@VM_64_7_centos tmp]# getfacl test.sh
# file: test.sh
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

[root@VM_64_7_centos tmp]# setfacl -m u:test:rwx test.sh
[root@VM_64_7_centos tmp]# getfacl test.sh
# file: test.sh
# owner: root
# group: root
user::rwx
user:test:rwx
group::r-x
mask::rwx
other::r-x

[root@VM_64_7_centos tmp]# setfacl -x user:test test.sh
[root@VM_64_7_centos tmp]# getfacl test.sh
# file: test.sh
# owner: root
# group: root
user::rwx
group::r-x
mask::r-x
other::r-x

[root@VM_64_7_centos tmp]# ls -l
total 8
-rwxr-xr-x+ 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# setfacl -b test.sh
[root@VM_64_7_centos tmp]# getfacl test.sh
# file: test.sh
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

[root@VM_64_7_centos tmp]#

运行结果:

[root@VM_64_7_centos tmp]# ls -l
total 8
---------- 1 root root 616 Dec 18 13:48 test.sh
[root@VM_64_7_centos tmp]# bash test.sh

current sh file name ./test.sh ./test.sh ./test.sh_file
10470
total value is:4
10 * 20 = 200
a==b or a>0
9
file enable write
file is not empty
0
1
2
a
b
c
array length is 3; array contain element is: a b c
5
6
call count function 10+20=30

[root@VM_64_7_centos tmp]# ./test.sh
-bash: ./test.sh: Permission denied

sheel脚本内容:

#! /bin/bash
echo "current sh file name $0 ${0} $0_file"
echo $$
value=`expr 2 + 2`
echo "total value is:${value}"
a=10
b=20
ab=`expr $a \* $b`
echo "$a * $b = $ab"

#echo "please inputi c:"
#read c
#ab=`expr $a / $c`
#echo "$a/$c=${ab}"

if [ $a == $b -o $a -gt 0 ];
then
echo "a==b or a>0"
else
echo "a!=b"
fi

str="dog,cat,fish,cattle,pig,rabbit"
echo `expr index $str fish`

file="/usr/tmp/file.test"
if [ -e ${file} ]
then
if [ -w $file ]
then
echo "file enable write"
fi
if [ -s $file ]
then
echo "file is not empty"
else
echo "file is empty"
fi
fi

#loop
for ((i=0;i<3;i++))
do echo $i
done

#array=(a b c)
array[0]=a
array[1]=b
array[2]=c
for i in ${array[@]}
do echo $i
done
echo "array length is" ${#array[@]}"; array contain element is:" ${array[@]}

j=5
while [ $j -lt 7 ]
do
echo $j
j=$(($j+1))
done

name=bird
case $name in
dog)
echo $name;;
cat)
echo $name;;
fish)
echo $name;;
rabbit)
echo $name;;
esac

total=0
count(){
total=$(($1+$2))
}

count 10 20
echo "call count function 10+20=$total"

echo ${array[@]} >> /usr/tmp/file.test

<<EOF

read var
echo "You input is $var"
EOF

 

Linux基础学习笔记以及常用命令的更多相关文章

  1. 【Linux基础学习】Ubuntu 常用命令大全

    一.文件目录类 1.建立目录:mkdir 目录名 2.删除空目录:rmdir 目录名 3.无条件删除子目录: rm -rf 目录名 4.改变当前目录:cd 目录名 (进入用户home目录:cd ~:进 ...

  2. git学习笔记:常用命令总结

    本文根据廖雪峰的博客,记录下自己的学习笔记.主要记录常用的命令,包括仓库初始化.添加文件.提交修改.新建分支.内容暂存.分支管理.标签管理等内容. git是分布式版本控制系统. 首先是安装,从官网下载 ...

  3. Linux基础学习笔记6-SHELL编程

    编程基础 程序:指令+数据 程序编程风格: 过程式:以指令为中心,数据服务于指令 对象式:以数据为中心,指令服务于数据 shell程序:提供了编程能力,解释执行 编程基本概念: 顺序执行:循环执行:选 ...

  4. Linux基础学习笔记4-文本处理

    本章内容 抽取文本的工具 文件内容:less和cat 文件截取:head和tail 按列抽取:cut 按关键字抽取:grep 文件查看 文件查看命令:cat,tac,rev cat [OPTION] ...

  5. linux基础(4)-常用命令

    常用命令ls ls #查看当前目录下的文件和目录 ls -l #显示详细信息 ls -a #显示所有文件 ls -t #按修改时间排序 ls -S #按文件大小排序   常用命令pwd pwd #显示 ...

  6. CentOS7学习笔记(四) 常用命令记录

    查看命令的帮助信息 man 命令查看帮助信息 在想要获取帮助信息的命令前面加上man即可,例如查看ls命令的帮助信息 [root@localhost ~]# man ls help 命令查看帮助信息 ...

  7. Linux学习笔记:常用命令

    个人常用的Linux命令总结(持续更新): 切换目录:cd 列出目录下面的文件:ls 显示当前所在的目录:pwd 操作文件 新建文件:touch file01 查看文件内容:less more cat ...

  8. Linux学习笔记:常用命令grep、iconv、cp、mv、rm

    本篇记录一些近期常用的命令. 一.grep过滤 grep过滤 不包含某些字符串 cat test.txt | grep -v '.jpg' 过滤jpg结尾的图片 cat test.txt | grep ...

  9. LInux学习笔记之常用命令

    以下命令主要是平时用到的命令,对于一些经常用到的,就收集资料,归纳一下. 指令目录: 1.yum命令: 2.wget命令: 3.tar命令: 4../configure,make,make insta ...

随机推荐

  1. 【唯星宠物】——CSS/BootStrap/Jquery爬坑之响应式首页

    前言:唯星宠物产品官网,分为首页.子页和登录注册页三个页面,除网页内容设计与图片素材的部分使用网上的材料之外,其余内容呈现以及功能模块全部为自己重构. 一.响应式轮播banner 思路:使用BootS ...

  2. Hdu 1698(线段树 区间修改 区间查询)

    In the game of DotA, Pudge's meat hook is actually the most horrible thing for most of the heroes. T ...

  3. Knight Moves

    Problem Description A friend of you is doing research on the Traveling Knight Problem (TKP) where yo ...

  4. JavaScript 和 TypeScript 交叉口 —— 类型定义文件(*.d.ts)

    在 <从 JavaScript 到 TypeScript 系列> 文章我们已经学习了 TypeScript 相关的知识. TypeScript 的核心在于静态类型,我们在编写 TS 的时候 ...

  5. ldap数据库--ODSEE--schema

    ldap服务器包含上百个对象类型(object class)和属性,这些对象类和属性都可以满足大部分需求,如果你想定义自己的schema,你只能继承扩展现有的schema进行操作. tip: 增加的新 ...

  6. [转载] ZooKeeper原理及使用

    转载自http://www.wuzesheng.com/?p=2609 ZooKeeper是Hadoop Ecosystem中非常重要的组件,它的主要功能是为分布式系统提供一致性协调(Coordina ...

  7. linux操作系统基础篇(五)

    Linux网络以及rpm安装yum源的配置 1.Linux网络 1. 使用ifconfig命令来维护网络1) fconfig命令的功能:显示所有正在启动的网卡的详细信息或设定系统中网卡的IP地址.2) ...

  8. Facebook-Haystack合并小文件

    1.原文 https://www.usenix.org/legacy/event/osdi10/tech/full_papers/Beaver.pdf 2.翻译版 http://www.importn ...

  9. mybatis逆向工程使用步骤详解

    使用mybatis生成逆向工程的详细步骤,我个人感觉这个是最简单的一个了,虽然网上有很多种的方法来生成逆向工程,可是这个方法最简单.在这里我是使用maven搭建的环境,但是在正常的环境下也是一样的.步 ...

  10. websocket做手机页面聊天与PC页面聊天一对一的即时通讯

    当时要写这个需求的时候,很头痛,手机端页面的客服功能,相当于QQ这样一个一对一聊天室功能了,瞬间蒙蔽的我也不知道用什么去写这个东西,一开始用ajax,定时器去写,写着写着发现这尼玛不在同一个页面怎么做 ...