linux解压的命令开放WindowMysql权限后台项目Linux部署

 

tar包: tar -xvf jdk-7u51-linux-x64.tar.gz

rpm 包rpm -ivh Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

开放WindowMysql权限

4.4.1 说明:

Window中的mysql一般不允许外界通过远程连接.需要开启mysql远程访问权限

 

语法:

grant [权限] on [数据库名].[表名] to ['用户名']@['web服务器的ip地址'] identified by ['密码'];

 

grant all on *.* to 'root'@'%' identified by 'root';

或者指定IP地址

grant all on *.* to 'root'@'192.168.1.103' identified by 'root';

 

说明:

赋予全部权限 on 全部库的.全部表 to ‘用户名’@’%任意IP地址’ identified by ‘登陆密码root’

后台项目Linux部署

4.1 VMware的使用

4.1.1 使用VMware介绍

说明:

VMware是一款虚拟化技术的产品.可以在window的系统中通过没有配置实现Linux系统的运行.

 

网卡:

VMnet1:负责桥接模式的网络配置

VMnew8:负责nat模式的网络配置

注意:一般情况下不要随意的修改.

 

4.1.2  链接模式

 

  1. 桥接模式

如果采用桥接模式,则虚拟机就像网络邻居一样.独占当前网络环境的一个IP地址

192.168.1.100 本机IP地址

192.168.1.101 虚拟机IP地址

2台机器同处于一个网络环境中,可以相互通信.

 

  1. NAT模式

如果采用NAT模式相当于在当前计算机中,又开辟了一块全新的网络空间,这块网络空间只允许主机访问,别人访问不到.

 

 

 

点击open in Terminal

出现如下窗口:

 

回车

 

 

 

[root@localhost Desktop]# ifconfig

eth2      Link encap:Ethernet  HWaddr 00:0C:29:79:DF:DE  

inet addr:192.168.161.130  Bcast:192.168.161.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe79:dfde/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:142847 errors:0 dropped:0 overruns:0 frame:0

          TX packets:41042 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:199300193 (190.0 MiB)  TX bytes:5139420 (4.9 MiB)

 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:48 errors:0 dropped:0 overruns:0 frame:0

          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:2682 (2.6 KiB)  TX bytes:2682 (2.6 KiB)

 

[root@localhost Desktop]#

 

inet addr:192.168.161.130这就虚拟机IP

 

在Xshell中点击新建

 

 

 

Last login: Mon Jan 22 03:21:00 2018 from 192.168.161.1

[root@localhost ~]#

4.1.3 虚拟机克隆

  1. 创建连接克隆

说明:

依赖于真实的机器,但是克隆时只会克隆一些配置文件,系统的主体文件使用真实机器的.

好处:克隆的速度较快,占用的资源较少.

要求:真实的虚拟机必须能够正常使用,否则克隆的机器都不能正常运行.

4.1.4 配置JDK

192.168.161.130

192.168.161.130

192.168.161.130

 

 

vim /etc/profile 编辑系统环境变量

#set java env

JAVA_HOME=/usr/local/src/java/jdk1.7.0_51

JAVA_BIN=/usr/local/src/java/jdk1.7.0_51/bin

PATH=$JAVA_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME JAVA_BIN PATH CLASSPATH

 

4.1.5 导入jdk安装包

[root@localhost src]# pwd

/usr/local/src

[root@localhost src]# mkdir java

[root@localhost src]# ls

java

[root@localhost src]# cd java/

[root@localhost java]# clear

说明:根据JDK的路径,查看JDK安装文件

创建java文件后,JDK的安装Jar包导入/usr/local/src/java

 

 

 

 

 

tar -xvf jdk-7u51-linux-x64.tar.gz

 

 

 

 

 

4.2 Tomcat部署

4.2.1 创建文件夹tomcats

[root@localhost src]# pwd

/usr/local/src

[root@localhost src]# mkdir tomcats

[root@localhost src]# ls

java  tomcats

[root@localhost src]#

 

4.2.2 添加tomcat安装文件

 

 

4.2.3  

4.2.4  

4.2.5 解压tomcat

tar -xvf apache-tomcat-7.0.55.tar.gz

4.2.6 启动tomcat

 

cd bin  

sh startup.sh

4.2.7 关闭防火墙

service iptables stop

 

单台linux:

4.3 京淘后台Tomcat部署

4.3.1 改变Mysql链接

说明:由于Linux中暂时没有安装Mysql.所以通过Linux访问windowMysql

IP:192.168.126.1

 

 

修改数据库配置文件

 

 

4.3.2 Tomcat部署

  1. 先将tomcat关闭

sh shutdown.sh

  1. 删除原有ROOT文件

rm -rf ROOT

  1. 上传war
  2. 查看启动日志

进入文件夹下 /usr/local/src/tomcats/tomcat7-8080/logs

cat catalina.out

4.4 开放WindowMysql权限

4.4.1 说明:

Window中的mysql一般不允许外界通过远程连接.需要开启mysql远程访问权限

 

语法:

grant [权限] on [数据库名].[表名] to ['用户名']@['web服务器的ip地址'] identified by ['密码'];

 

grant all on *.* to 'root'@'%' identified by 'root';

或者指定IP地址

grant all on *.* to 'root'@'192.168.1.103' identified by 'root';

 

说明:

赋予全部权限 on 全部库的.全部表 to ‘用户名’@’%任意IP地址’ identified by ‘登陆密码root’

 

 

表示开启mysql权限

 

4.4.2 测试远程连接

 

后台数据库搭建

5.1 数据库Linux部署

5.1.1 准备服务器

说明:将空白虚拟机进行克隆,修改名称mysql-master.

 

 

5.1.2 拍摄快照

说明:一般采用快照的方式记录当前虚拟机状态,如果后期操作过程中,造成了不可挽回的损失,则直接恢复快照即可.

 

 

通过上述操作可以实现系统的回滚

5.1.3 固定IP地址

 

说明:点击网络配置后选择最新的网络环境autoeth3.点击Edit

选择IpV4进行IP配置

 

 

 

 

 

 

 

 

 

 

 

 

[c:\~]$ ssh 192.168.161.131

 

 

Connecting to 192.168.161.131:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

 

Last login: Mon Jan 22 17:01:40 2018 from 192.168.161.1

[root@localhost ~]# cd /usr/local/src

[root@localhost src]# mkdir mysql

[root@localhost src]# cd mysql

[root@localhost mysql]# rz –E//直接将压缩文件(Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar)拖到当前目录

 

 

rz waiting to receive.

[root@localhost mysql]# ls

[root@localhost mysql]# rz –E //jt.sql文件拖到当前目录

 

rz waiting to receive.

[root@localhost mysql]# ls

jt.sql

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

[root@localhost mysql]# tar -xvf Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tarPercona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

[root@localhost mysql]# ls

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

 

 

[root@localhost mysql]# ls

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

[root@localhost mysql]# rpm -ivh Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

warning: Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-56-debug########################################### [100%]

 [root@localhost mysql]# rpm -ivh Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

warning: Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-shared-5########################################### [100%]

[root@localhost mysql]# rpm -ivh Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

warning: Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-client-5########################################### [100%]

[root@localhost mysql]# rpm -ivh Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

 

 

 

 

 

 

 

启动服务:

service mysql start

设置用户名和密码:

mysqladmin -u 'root' password 'root'

登录数据库:

[root@localhost mysql]# mysql -uroot –p

 

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.24-72.2 Percona Server (GPL), Release 72.2, Revision 8d0f85b

 

Copyright (c) 2009-2015 Percona LLC and/or its affiliates

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql>

 

导入jt.sql

source jt.sql;

 

 

开放权限

grant all on *.* to 'root'@'%' identified by 'root';

退出数据库

mysql> exit;

关闭防火墙(linux

service iptables stop;

 

查询当前进程号

ps -ef | grep mysql

 

 

root      2838     1  0 22:22 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid

mysql     3004  2838  0 22:22 pts/2    00:00:07 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock

root      3132  2696  0 22:44 pts/2    00:00:00 grep mysql

 

强制删除(如果报错信息中含有xxx.pidsocket

[root@localhost mysql]# kill -9 3004

 

启动二进制文件:(/etc/my.cnf)

[root@localhost mysql]# cd /etc

[root@localhost etc]# ll

total 1864

drwxr-xr-x.  3 root root   4096 Oct  4  2015 abrt

drwxr-xr-x.  4 root root   4096 Oct  4  2015 acpi

-rw-r--r--.  1 root root     44 Apr  9  2017 adjtime

-rw-r--r--.  1 root root   1512 Jan 12  2010 aliases

-rw-r--r--.  1 root root  12288 Oct  4  2015 aliases.db

drwxr-xr-x.  2 root root   4096 Oct  4  2015 alsa

drwxr-xr-x.  2 root root   4096 Oct  4  2015 alternatives

-rw-------.  1 root root    541 Nov 23  2013 anacrontab

-rw-r--r--.  1 root root    148 May 14  2009 asound.conf

-rw-r--r--.  1 root root      1 Jan 30  2012 at.deny

drwxr-x---.  3 root root   4096 Oct  4  2015 audisp

drwxr-x---.  2 root root   4096 Oct  4  2015 audit

drwxr-xr-x.  2 root root   4096 Oct  4  2015 avahi

drwxr-xr-x.  2 root root   4096 Jul 10  2016 bash_completion.d

-rw-r--r--.  1 root root   2681 Oct  2  2013 bashrc

drwxr-xr-x.  2 root root   4096 May 10  2016 blkid

drwxr-xr-x.  2 root root   4096 Oct  4  2015 bluetooth

drwxr-xr-x.  2 root root   4096 Oct  4  2015 bonobo-activation

-rw-r--r--.  1 root root     27 Nov 27  2013 centos-release

drwxr-xr-x.  2 root root   4096 Sep 23  2013 chkconfig.d

drwxr-xr-x.  5 root root   4096 Oct  4  2015 ConsoleKit

drwxr-xr-x.  2 root root   4096 Oct  4  2015 cron.d

drwxr-xr-x.  2 root root   4096 Oct  4  2015 cron.daily

-rw-------.  1 root root      0 Nov 23  2013 cron.deny

drwxr-xr-x.  2 root root   4096 Oct  4  2015 cron.hourly

drwxr-xr-x.  2 root root   4096 Oct  4  2015 cron.monthly

-rw-r--r--.  1 root root    457 Sep 26  2011 crontab

drwxr-xr-x.  2 root root   4096 Sep 26  2011 cron.weekly

-rw-r--r--.  1 root root      0 Oct  4  2015 crypttab

-rw-r--r--.  1 root root   1602 Oct  2  2013 csh.cshrc

-rw-r--r--.  1 root root    794 Oct  2  2013 csh.login

drwxr-xr-x.  5 root lp     4096 Jan 23 02:15 cups

drwxr-xr-x.  4 root root   4096 Oct  4  2015 dbus-1

drwxr-xr-x.  2 root root   4096 Oct  4  2015 default

drwxr-xr-x.  2 root root   4096 Oct  4  2015 depmod.d

drwxr-x---.  3 root root   4096 Nov 22  2013 dhcp

-rw-r--r--.  1 root root   4439 Oct 17  2013 DIR_COLORS

-rw-r--r--.  1 root root   5139 Oct 17  2013 DIR_COLORS.256color

-rw-r--r--.  1 root root   4113 Oct 17  2013 DIR_COLORS.lightbgcolor

-rw-r--r--.  1 root root  21214 Feb 21  2013 dnsmasq.conf

drwxr-xr-x.  2 root root   4096 Feb 21  2013 dnsmasq.d

-rw-r--r--.  1 root root    519 Nov 26  2013 dracut.conf

drwxr-xr-x.  2 root root   4096 Oct  4  2015 dracut.conf.d

-rw-r--r--.  1 root root   1804 Nov 25  2013 drirc

-rw-r--r--.  1 root root   4843 Nov 10  2010 enscript.cfg

-rw-r--r--.  1 root root      0 Oct  2  2013 environment

-rw-r--r--.  1 root root     28 May 10  2012 ethers

drwxr-xr-x.  2 root root   4096 Oct  4  2015 event.d

-rw-r--r--.  1 root root      0 Jan 12  2010 exports

lrwxrwxrwx.  1 root root     56 Oct  4  2015 favicon.png -> /usr/share/icons/hicolor/16x16/apps/system-logo-icon.png

drwxr-xr-x.  2 root root   4096 Oct  4  2015 festival

-rw-r--r--.  1 root root     64 Oct  2  2013 filesystems

drwxr-xr-x.  4 root root   4096 Oct  4  2015 fonts

drwxr-xr-x.  2 root root   4096 Oct  4  2015 foomatic

-rw-r--r--.  1 root root     20 Nov 22  2013 fprintd.conf

-rw-r--r--.  1 root root    805 Oct  4  2015 fstab

-rw-r--r--.  1 root root      0 Nov 21  2013 gai.conf

drwxr-xr-x.  7 root root   4096 Oct  4  2015 gconf

drwxr-xr-x.  2 root root   4096 Oct 24  2013 gcrypt

drwxr-xr-x.  6 root root   4096 Oct  4  2015 gdm

drwxr-xr-x.  3 root root   4096 Oct  4  2015 ghostscript

drwxr-xr-x.  3 root root   4096 Oct  4  2015 gnome-vfs-2.0

drwxr-xr-x.  2 root root   4096 Oct 24  2013 gnupg

-rw-r--r--.  1 root root    804 Jan 23 02:28 group

-rw-------.  1 root root    791 Nov  6  2015 group-

lrwxrwxrwx.  1 root root     22 Oct  4  2015 grub.conf -> ../boot/grub/grub.conf

----------.  1 root root    658 Jan 23 02:28 gshadow

-rw-------.  1 root root    648 Nov  6  2015 gshadow-

-rw-r--r--.  1 root root    801 Jul 19  2011 gssapi_mech.conf

drwxr-xr-x.  3 root root   4096 Oct  4  2015 gtk-2.0

drwxr-xr-x.  3 root root   4096 Oct  4  2015 hal

-rw-r--r--.  1 root root      9 Oct  2  2013 host.conf

-rw-r--r--.  1 root root    158 Jan 12  2010 hosts

-rw-r--r--.  1 root root    370 Jan 12  2010 hosts.allow

-rw-r--r--.  1 root root    460 Jan 12  2010 hosts.deny

drwxr-xr-x.  2 root root   4096 Oct  4  2015 hp

drwxr-xr-x.  4 root root   4096 Oct  4  2015 httpd

-rw-r--r--.  1 root root   3581 Jul 24  2015 idmapd.conf

drwxr-xr-x.  2 root root   4096 Oct  4  2015 init

lrwxrwxrwx.  1 root root     11 Oct  4  2015 init.d -> rc.d/init.d

-rw-r--r--.  1 root root    884 Oct  4  2015 inittab

-rw-r--r--.  1 root root    942 Jan 12  2010 inputrc

drwxr-xr-x.  2 root root   4096 Oct  4  2015 iproute2

-rw-r--r--.  1 root root     47 Nov 27  2013 issue

-rw-r--r--.  1 root root     46 Nov 27  2013 issue.net

drwxr-xr-x.  4 root root   4096 Oct  4  2015 kdump-adv-conf

-rw-r--r--.  1 root root   7786 Oct  4  2015 kdump.conf

-rw-r--r--.  1 root root    449 Apr 10  2015 krb5.conf

-rw-r--r--.  1 root root  57616 Jan 23 02:28 ld.so.cache

-rw-r--r--.  1 root root     28 Jul 24  2013 ld.so.conf

drwxr-xr-x.  2 root root   4096 Oct  4  2015 ld.so.conf.d

-rw-r-----.  1 root root    191 Mar  1  2012 libaudit.conf

drwxr-xr-x.  5 root root   4096 Oct  4  2015 libreport

-rw-r--r--.  1 root root   2290 Oct  4  2015 libuser.conf

-rw-r--r--.  1 root root   2819 Oct  4  2015 localtime

-rw-r--r--.  1 root root   1831 Oct  4  2015 login.defs

-rw-r--r--.  1 root root    662 Aug 29  2007 logrotate.conf

drwxr-xr-x.  2 root root   4096 Jan 23 02:28 logrotate.d

drwxr-xr-x.  5 root root   4096 Oct  4  2015 lvm

-rw-r--r--.  1 root root    111 Oct  4  2012 magic

-rw-r--r--.  1 root root    272 Nov 17  2009 mailcap

-rw-r--r--.  1 root root   1909 Aug  1  2013 mail.rc

drwxr-xr-x.  2 root root   4096 Oct  4  2015 makedev.d

-rw-r--r--.  1 root root   4940 Feb 21  2013 man.config

-rw-r--r--.  1 root root  43591 Sep 23  2011 mime.types

-rw-r--r--.  1 root root    827 Jul 24  2015 mke2fs.conf

drwxr-xr-x.  2 root root   4096 Oct  4  2015 modprobe.d

-rw-r--r--.  1 root root      0 Jan 12  2010 motd

-rw-r--r--.  1 root root    444 Jan 23 02:15 mtab

-rw-r--r--.  1 root root   2620 Aug 16  2010 mtools.conf

-rw-r--r--.  1 root root    251 Nov 22  2013 my.cnf

-rw-r--r--.  1 root root   7846 Nov 11  2010 nanorc

-rw-r--r--.  1 root root    767 Nov 30  2009 netconfig

进入配置文件

[root@localhost mysql]# cd /etc

[root@localhost etc]# vim my.cnf

 

进入后写:配置

server-id=1

log-bin=mysql-bin

如下

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

server-id=2

log-bin=mysql-bin

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

~                                   

(保存)退出Esc+Shift++wq

:wq

 

重新启动服务器

[root@localhost mysql]# service mysql restart

Shutting down MySQL (Percona Server)... SUCCESS!

Starting MySQL (Percona Server)..... SUCCESS!

[root@localhost mysql]# ls

jt.sql

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

检查文件

[root@localhost mysql]# cd /var/lib/mysql

[root@localhost mysql]#ll  

rw-rw----. 1 mysql mysql       56 Jan 22 23:50 auto.cnf

-rw-rw----. 1 mysql mysql 12582912 Jan 22 23:59 ibdata1

-rw-rw----. 1 mysql mysql 50331648 Jan 22 23:59 ib_logfile0

-rw-rw----. 1 mysql mysql 50331648 Jan 22 23:46 ib_logfile1

-rw-rw----. 1 mysql mysql        5 Jan 22 23:59 localhost.localdomain.pid

drwx------. 2 mysql mysql     4096 Jan 22 23:46 mysql

-rw-rw----. 1 mysql mysql      120 Jan 22 23:59 mysql-bin.000001

-rw-rw----. 1 mysql mysql       19 Jan 22 23:59 mysql-bin.index

//这两个说明成功

 

 

 

 

开启从服务器(Linux

 

 

 

 

 

 

 

[c:\~]$ ssh 192.168.161.133

 

Xshell 5 (Build 0469)

Copyright (c) 2002-2014 NetSarang Computer, Inc. All rights reserved.

 

Type `help' to learn how to use Xshell prompt.

[c:\~]$ ssh 192.168.161.133

 

连接虚拟机

Connecting to 192.168.161.133:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

 

Last login: Mon Jan 22 17:01:40 2018 from 192.168.161.1

[root@localhost ~]# cd /usr/local/src

[root@localhost src]# mkdir mysql

[root@localhost src]# cd mysql

[root@localhost mysql]# rz –E(导包)

rz waiting to receive.

[root@localhost mysql]# rz –E(导文件)

rz waiting to receive.

[root@localhost mysql]# ls

jt.sql  

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

[root@localhost mysql]# tar -xvf Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

[root@localhost mysql]# ls

jt.sql                                                     

Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm  Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar  Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm   Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm

Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm  Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm  Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm

[root@localhost mysql]# rpm -ivh Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm

warning:Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-56-debug########################################### [100%]

[root@localhost mysql]# rpm -ivh Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm

warning:Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-shared-5########################################### [100%]

[root@localhost mysql]# rpm -ivh  Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm

warning:Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-client-5########################################### [100%]

[root@localhost mysql]# rpm -ivh  Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

warning:Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY

Preparing...                ########################################### [100%]

   1:Percona-Server-server-5########################################### [100%]

See http://www.percona.com/doc/percona-server/5.6/management/udf_percona_toolkit.html for more details

[root@localhost mysql]# service mysql start

Starting MySQL (Percona Server)...... SUCCESS!

[root@localhost mysql]#mysqladmin -u 'root' password 'root'

Warning: Using a password on the command line interface can be insecure.

[root@localhost mysql]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.24-72.2 Percona Server (GPL), Release 72.2, Revision 8d0f85b

 

Copyright (c) 2009-2015 Percona LLC and/or its affiliates

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> source jt.sqlWarning: Using a password on the command line interface can be insecure.

[root@localhost mysql]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.24-72.2 Percona Server (GPL), Release 72.2, Revision 8d0f85b

 

Copyright (c) 2009-2015 Percona LLC and/or its affiliates

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> source jt.sql

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.03 sec)

 

Query OK, 0 rows affected (0.01 sec)

 

Query OK, 0 rows affected (0.01 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 1 row affected (0.04 sec)

 

Database changed

Query OK, 0 rows affected (0.01 sec)

 

Query OK, 0 rows affected (0.26 sec)

 

Query OK, 3 rows affected (0.03 sec)

Records: 3  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.07 sec)

 

Query OK, 11 rows affected (0.02 sec)

Records: 11  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.04 sec)

 

Query OK, 8 rows affected (0.01 sec)

Records: 8  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.08 sec)

 

Query OK, 3101 rows affected (1.07 sec)

Records: 3101  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.05 sec)

 

Query OK, 0 rows affected (0.13 sec)

 

Query OK, 1182 rows affected (0.08 sec)

Records: 1182  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.05 sec)

 

Query OK, 523 rows affected (1.93 sec)

Records: 523  Duplicates: 0  Warnings: 0

 

Query OK, 907 rows affected (0.31 sec)

Records: 907  Duplicates: 0  Warnings: 0

 

Query OK, 1243 rows affected (0.34 sec)

Records: 1243  Duplicates: 0  Warnings: 0

 

Query OK, 532 rows affected (0.15 sec)

Records: 532  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.05 sec)

 

Query OK, 0 rows affected (0.21 sec)

 

Query OK, 1 row affected (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.05 sec)

 

Query OK, 6 rows affected (0.01 sec)

Records: 6  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.15 sec)

 

Query OK, 25 rows affected (0.01 sec)

Records: 25  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.03 sec)

 

Query OK, 26 rows affected (0.01 sec)

Records: 26  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.04 sec)

 

Query OK, 22 rows affected (0.05 sec)

Records: 22  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.10 sec)

 

Query OK, 3 rows affected (0.00 sec)

Records: 3  Duplicates: 0  Warnings: 0

 

Query OK, 0 rows affected (0.08 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

Query OK, 0 rows affected (0.01 sec)

 

mysql> grant all on *.* to 'root'@'%' identified by 'root';

Query OK, 0 rows affected (0.08 sec)

 

mysql> exit

Bye

 [root@localhost mysql]# service iptables stop;

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

[root@localhost mysql]# ps -ef | grep mysql

mysql     2877  2711  0 03:28 pts/0    00:00:03 /usr/sbin/mysqld

[root@localhost mysql]# cd /etc

[root@localhost etc]# vim my.cnf

 

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

server-id=4

log-bin=mysql-bin

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

~

(保存)退出Esc+Shift++wq

:wq

 

重新启动服务器

[root@localhost mysql]# service mysql restart

Shutting down MySQL (Percona Server).. SUCCESS!

Starting MySQL (Percona Server)...... SUCCESS!

检测文件

[root@localhost etc]# cd /var/lib/mysql

[root@localhost mysql]# ll

total 110632

-rw-rw----. 1 mysql mysql       56 Jan 23 03:29 auto.cnf

-rw-rw----. 1 mysql mysql 12582912 Jan 23 03:48 ibdata1

-rw-rw----. 1 mysql mysql 50331648 Jan 23 03:48 ib_logfile0

-rw-rw----. 1 mysql mysql 50331648 Jan 23 03:28 ib_logfile1

drwx------. 2 mysql mysql     4096 Jan 23 03:35 jtdb

-rw-rw----. 1 mysql mysql        5 Jan 23 03:48 localhost.localdomain.pid

drwx------. 2 mysql mysql     4096 Jan 23 03:28 mysql

-rw-rw----. 1 mysql mysql      120 Jan 23 03:48 mysql-bin.000001

-rw-rw----. 1 mysql mysql       19 Jan 23 03:48 mysql-bin.index

srwxrwxrwx. 1 mysql mysql        0 Jan 23 03:48 mysql.sock

drwx------. 2 mysql mysql     4096 Jan 23 03:28 performance_schema

-rw-r--r--. 1 root  root       117 Jan 23 03:28 RPM_UPGRADE_HISTORY

-rw-r--r--. 1 mysql mysql      117 Jan 23 03:28 RPM_UPGRADE_MARKER-LAST

drwx------. 2 mysql mysql     4096 Jan 23 03:28 test

[root@localhost mysql]#     

 

                                  

posted @ 2018-03-21 17:51  小黑妹007  阅读(526)  评论(0编辑  收藏  举报