ssh -l root 127.0.0.1
mysql -u root -p
tail -f catalina.out
cp -R /opt/root.war root/
ps -ef |grep tomcat
mysql -uroot -pssss
mysqldump -u root -p wuhj > /opt/2015-11-21.sql
yum update 更新軟件
yum -y update
升級所有包,改變軟件設置和系統設置,系統版本內核都升級
yum -y upgrade
升級所有包,不改變軟件設置和系統設置,系統版本升級,內核不改變
首先爲yum添加epel源:yum install epel-release搜索回車
再次:yum install redis回車
線程掛起在後臺 nohup service redis start
鏈接遠程數據庫 mysql -u user-p --host=192.168.2.5
關於LINUX權限-bash: ./startup.sh: Permission denied
<script type="text/javascript"></script><script type="text/javascript"></script>
在執行./startup.sh,或者./shutdown.sh的時候,爆出了Permission denied,
其實很簡單,就是今天在執行tomcat的時候,用戶沒有權限,而導致無法執行,
用命令chmod 修改一下bin目錄下的.sh權限就可以了
如chmod u+x *.sh
在此執行,OK了。
service iptables status 查看防火牆狀態
service iptables start 開啓防火牆
service iptables stop 關閉防火牆
service iptables restart 重啓防火牆
防火牆開放特定端口:
①文件/etc/sysconfig/iptables
②添加:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
★數字8080代表開放8080端口,也可以改成其他的端口★
③重啓防火牆
================================================================
保存對防火牆的設置
serivce iptables save
查看iptables規則及編號
iptables -nL --line-number
關閉所有的INPUT FORWARD(轉發) OUTPUT的所有端口
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
只打開22端口
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
參數講解:
–A 參數就看成是添加一條規則
–p 指定是什麼協議,我們常用的tcp 協議,當然也有udp,例如53端口的DNS
–dport 就是目標端口,當數據從外部進入服務器爲目標端口
–sport 數據從服務器出去,則爲數據源端口使用
–j 就是指定是 ACCEPT -接收 或者 DROP 不接收
禁止某個IP訪問
iptables -A INPUT -p tcp -s 192.168.1.2 -j DROP
–s 參數是來源(即192.168.1.2)
後面拒絕就是DROP
刪除規則
iptables -D INPUT 2
刪除INPUT鏈編號爲2的規則
CentOS7的yum源中默認好像是沒有mysql的。爲了解決這個問題,我們要先下載mysql的repo源。
1. 下載mysql的repo源
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. 安裝mysql-community-release-el7-5.noarch.rpm包
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
安裝這個包後,會獲得兩個mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
3. 安裝mysql
$ sudo yum install mysql-server
啓動mysql服務:
service mysqld start或者/etc/init.d/mysqld start
開機啓動 mysql
chkconfig mysql on
設置mysql密碼
mysqladmin -u root password ssssss
開啓遠程
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '11111' WITH GRANT OPTION;
防火牆
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
3、重啓防火牆
service iptables restart
注意:增加的開放3306端口的語句一定要在icmp-host-prohibited之前
nginx最新源
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
解決
/bin/chown: “nginx:adm”: 無效的組
/bin/chown: “nginx:adm”: 無效的組
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
groupadd adm~~~~~~~~~~
卸載軟件
rpm -e nginx
mysql 新設置用戶或更改密碼後需用flush privileges刷新MySQL的系統權限相關表,否則會出現拒絕訪問,還有一種方法,就是重新啓動mysql服務器,來使新設置生效。
mysqldump -u 用戶名 -p 數據庫名 > 導出的文件名 mysqldump -u linuxde -p smgp_apps_linuxde > linuxde.sql
scp -r /home/space/music/ [email protected]:/home/root/others/
scp -r wealth.sql wealth_new.sql wealth_fund.sql efflow.sql jcb_new.sql root@XXXXXX:/root/
不能有空格
[root@TS-DEV ~]# yum install screen
[root@TS-DEV ~]# rpm -qa|grep screen
screen-4.0.3-4.el5
[root@TS-DEV ~]#
[root@TS-DEV ~]# screen -S david
導入sql source ygeshop.sql;
MySQL ('root'@'%') does not exist的問題
在使用mysql時出現問題: The user specified as a definer ('root'@'%') does not exist。
一般是由於root用戶對全局host無訪問權限。因此只要給root用戶添加一個訪問權限即可。
解決辦法:
登陸mysql ,執行
mysql -u root -pPasswd
mysql >grant all privileges on *.* to root@"%" identified by "Passwd" ;
mysql >flush privileges;
mysql -u root -pPasswd
mysql >grant all privileges on *.* to root@"%" identified by "Passwd" ;
mysql >flush privileges;
vim 的使用
:wq!