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. Python Web框架篇:Django cookie和session

    part 1 概念 在Django里面,cookie和session都记录了客户端的某种状态,用来跟踪用户访问网站的整个回话. 两者最大的区别是cookie的信息是存放在浏览器客户端的,而sessio ...

  2. HDU1255覆盖的面积

    覆盖的面积 Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submis ...

  3. 最最简单的CentOs6在线源搭建

    非常实用的在线源搭建,只要4步骤 1.点击进入http://mirrors.aliyun.com/repo/epel-6.repo ,这是阿里云的源 2.复制所有的代码  ctrl+a,ctrl+c ...

  4. null transform hack 强制使用硬件加速

    -webkit-transform: translateZ(0); -webkit-transform: translate3d(0,0,0);   作用: 1.切换到硬件合成模式,通常所有事情都CP ...

  5. Problem B: 农夫果园 简单点,出题的方式简单点

    我走过最长的路,就是教主的套路#include <iostream> #include <string> using namespace std; class Fruit { ...

  6. C#使用Oracle.ManagedDataAccess.dll

    在刚接触C#的时候由于公司使用的就是Oracle数据库,那么C#怎么连接Oracle数据库就成了首要去掌握的知识点了.在那时没有ODP.NET,但visual studio却对Oralce数据库的调用 ...

  7. MUI框架开发HTML5手机APP(一)--搭建第一个手机APP

      前  言 JRedu 随着HTML5的不断发展,移动开发成为主流趋势!越来越多的公司开始选择使用HTML5开发手机APP,而随着手机硬件设备配置的不断提升,各种开发框架的不断优化,也使着H5开发的 ...

  8. docker下编译mangoszero WOW60级服务端(二)

    开始搭建基于docker的mangoszero WOW服务端,我自己的操作系统是mac os,其他平台操作可以等价替换 1.准备工作 (1) 安装docker,参考docker官方文档,https:/ ...

  9. 我是如何理解Android的Handler模型_2

    对比例程说明,如: 例:在新新线程中替换TextView显示内容. 界面如下,单击按键后original data 替换为 changed data Handler Message部分实现步骤: 1. ...

  10. web前端-----第一弹html

    HTML 初识 web服务本质 import socket def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s ...