2013年10月2日 星期三

7. 架設Tomcat 6 MySql VPS CentOs 6安裝MySql5.5

From Evernote:

7. 架設Tomcat 6 MySql VPS CentOs 6安裝MySql5.5

7. 安裝MySql5.5

因為內yum的Mysql版本為5.1

所以要更新yum的資料

7-1 更新yum的資料

[root@jay ~]# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

Retrieving http://mirror.webtatic.com/yum/el6/latest.rpm

warning: /var/tmp/rpm-tmp.NglhSn: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY

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

  1:webtatic-release       ########################################### [100%]


[root@jay ~]# yum install mysql.`uname -i` yum-plugin-replace

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: centos.mirror.facebook.net

* extras: dal.tx.us.glomirror.com.au

* updates: centos.mirror.ndchost.com

* webtatic: us-east.repo.webtatic.com

webtatic                                                                   | 2.9 kB     00:00     

webtatic/primary_db                                                        | 191 kB     00:00     

Setting up Install Process

No package mysql.i386 available.

Resolving Dependencies

--> Running transaction check

---> Package yum-plugin-replace.noarch 0:0.2.5-2.ius.w6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


===================================================================================

Package                      Arch             Version                   Repository          Size

===================================================================================

Installing:

yum-plugin-replace           noarch           0.2.5-2.ius.w6            webtatic            17 k


Transaction Summary

===================================================================================

Install       1 Package(s)


Total download size: 17 k

Installed size: 33 k

Is this ok [y/N]: y

Downloading Packages:

yum-plugin-replace-0.2.5-2.ius.w6.noarch.rpm                               |  17 kB     00:00     

warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

Importing GPG key 0xCF4C4FF9:

Userid : Andy Thompson <andy@webtatic.com>

Package: webtatic-release-6-4.noarch (installed)

From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

 Installing : yum-plugin-replace-0.2.5-2.ius.w6.noarch                                       1/1

 Verifying  : yum-plugin-replace-0.2.5-2.ius.w6.noarch                                       1/1


Installed:

 yum-plugin-replace.noarch 0:0.2.5-2.ius.w6                                                      


Complete!


7-2 更改成mysql5.5 與安裝mysql5.5

[root@jay ~]# yum replace mysql --replace-with mysql55

Loaded plugins: fastestmirror, replace

Loading mirror speeds from cached hostfile

* base: centos.mirror.facebook.net

* extras: dal.tx.us.glomirror.com.au

* updates: centos.mirror.ndchost.com

* webtatic: us-east.repo.webtatic.com

Replacing packages takes time, please be patient...

Error: Package 'mysql' is not installed.

[root@jay ~]# yum install mysql55 mysql55-server

Loaded plugins: fastestmirror, replace

Loading mirror speeds from cached hostfile

* base: centos.mirror.facebook.net

* extras: dal.tx.us.glomirror.com.au

* updates: centos.mirror.ndchost.com

* webtatic: us-east.repo.webtatic.com

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package mysql55.i386 0:5.5.31-2.w6 will be installed

--> Processing Dependency: mysql55-libs = 5.5.31-2.w6 for package: mysql55-5.5.31-2.w6.i386

---> Package mysql55-server.i386 0:5.5.31-2.w6 will be installed

--> Processing Dependency: perl-DBI for package: mysql55-server-5.5.31-2.w6.i386

--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.31-2.w6.i386

--> Processing Dependency: perl(DBI) for package: mysql55-server-5.5.31-2.w6.i386

--> Processing Dependency: libaio.so.1(LIBAIO_0.4) for package: mysql55-server-5.5.31-2.w6.i386

--> Processing Dependency: libaio.so.1(LIBAIO_0.1) for package: mysql55-server-5.5.31-2.w6.i386

--> Processing Dependency: libaio.so.1 for package: mysql55-server-5.5.31-2.w6.i386

--> Running transaction check

---> Package libaio.i686 0:0.3.107-10.el6 will be installed

---> Package mysql55-libs.i386 0:5.5.31-2.w6 will be installed

--> Processing Dependency: libmysqlclient16 for package: mysql55-libs-5.5.31-2.w6.i386

---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be installed

---> Package perl-DBI.i686 0:1.609-4.el6 will be installed

--> Running transaction check

---> Package libmysqlclient16.i386 0:5.1.69-1.w6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


===================================================================================

Package                     Arch            Version                    Repository           Size

===================================================================================

Installing:

mysql55                     i386            5.5.31-2.w6                webtatic            6.0 M

mysql55-server              i386            5.5.31-2.w6                webtatic             10 M

Installing for dependencies:

libaio                      i686            0.3.107-10.el6             base                 21 k

libmysqlclient16            i386            5.1.69-1.w6                webtatic            1.1 M

mysql55-libs                i386            5.5.31-2.w6                webtatic            780 k

perl-DBD-MySQL              i686            4.013-3.el6                base                134 k

perl-DBI                    i686            1.609-4.el6                base                705 k


Transaction Summary

===================================================================================

Install       7 Package(s)


Total download size: 19 M

Installed size: 82 M

Is this ok [y/N]: y

Downloading Packages:

(1/7): libaio-0.3.107-10.el6.i686.rpm                                      |  21 kB     00:00     

(2/7): libmysqlclient16-5.1.69-1.w6.i386.rpm                               | 1.1 MB     00:00     

(3/7): mysql55-5.5.31-2.w6.i386.rpm                                        | 6.0 MB     00:02     

(4/7): mysql55-libs-5.5.31-2.w6.i386.rpm                                   | 780 kB     00:00     

(5/7): mysql55-server-5.5.31-2.w6.i386.rpm                                 |  10 MB     00:02     

(6/7): perl-DBD-MySQL-4.013-3.el6.i686.rpm                                 | 134 kB     00:00     

(7/7): perl-DBI-1.609-4.el6.i686.rpm                                       | 705 kB     00:00     

--------------------------------------------------------------------------------------------------

Total                                                             2.6 MB/s |  19 MB     00:07     

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

 Installing : perl-DBI-1.609-4.el6.i686                                                      1/7

 Installing : libmysqlclient16-5.1.69-1.w6.i386                                              2/7

 Installing : mysql55-libs-5.5.31-2.w6.i386                                                  3/7

 Installing : mysql55-5.5.31-2.w6.i386                                                       4/7

 Installing : perl-DBD-MySQL-4.013-3.el6.i686                                                5/7

 Installing : libaio-0.3.107-10.el6.i686                                                     6/7

 Installing : mysql55-server-5.5.31-2.w6.i386                                                7/7

 Verifying  : mysql55-libs-5.5.31-2.w6.i386                                                  1/7

 Verifying  : perl-DBD-MySQL-4.013-3.el6.i686                                                2/7

 Verifying  : mysql55-server-5.5.31-2.w6.i386                                                3/7

 Verifying  : libmysqlclient16-5.1.69-1.w6.i386                                              4/7

 Verifying  : perl-DBI-1.609-4.el6.i686                                                      5/7

 Verifying  : mysql55-5.5.31-2.w6.i386                                                       6/7

 Verifying  : libaio-0.3.107-10.el6.i686                                                     7/7


Installed:

 mysql55.i386 0:5.5.31-2.w6                   mysql55-server.i386 0:5.5.31-2.w6                  


Dependency Installed:

 libaio.i686 0:0.3.107-10.el6                  libmysqlclient16.i386 0:5.1.69-1.w6              

 mysql55-libs.i386 0:5.5.31-2.w6               perl-DBD-MySQL.i686 0:4.013-3.el6                

 perl-DBI.i686 0:1.609-4.el6                  


Complete!


7-3-1 Mysql啟動指令

[root@jay ~]# /etc/init.d/mysqld start

Starting mysqld:                                           [  OK  ]


7-3-2 Mysql停止指令

[root@jay ~]# /etc/init.d/mysqld stop

Stopping mysqld:                                           [  OK  ]


7-4 Mysql設定最高權限密碼先設1234,設定前請先啟動Mysql

[root@jay ~]# mysqladmin -u root password '1234'     #設定最高權限密碼1234

[root@jay ~]# mysql -u root -p                                 #進入Mysql

Enter password:       #輸入1234

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

Your MySQL connection id is 3

Server version: 5.5.31 MySQL Community Server (GPL)


Copyright (c) 2000, 2013, 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> exit  #離開mysql


7-5 Mysql設定開機自動啟動

[root@jay ~]# chkconfig --list mysqld      #查看自動啟動設定

mysqld          0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@jay ~]# chkconfig mysqld on        #設定自動啟動

[root@jay ~]# chkconfig --list mysqld    #如果2--5為on的狀態就OK

mysqld          0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@jay ~]# reboot   #重新開機試試



7-6 登入mysql看看

[root@jay ~]# mysql -u root -p  

Enter password:           #輸入1234

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

Your MySQL connection id is 3

Server version: 5.5.31 MySQL Community Server (GPL)


Copyright (c) 2000, 2013, 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>          #成功


沒有留言:

張貼留言