Prerequisites:
Check your OS' version:
[root@poller1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Check your existing MySQL that came with the Linux:
[root@poller1 mysql]# rpm -qa | grep -i mysql5.0.95-5.el5_9
perl-DBD-MySQL-3.0007-2.el5
mysql-5.0.95-5.el5_9
mysql-connector-odbc-3.51.30-0
mysql-5.0.95-5.el5_9
Login your existing MySQL and check your database:
[root@PTUDServer3 Desktop]# mysql -u root -p
Enter password:
***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 63
Server version: 5.0.95-log Source distribution
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.37 sec)
mysql>
use test;
Database changed
mysql> show tables;
empty in set (0.00 sec)
mysql>
You ensure haven't any application runs your MySQL. I checked no important application use my MySQL. So, I can remove it.
Remove the existing default MySQL that came with the Linux.
[root@poller1 mysql]# rpm -ev perl-DBD-MySQL-3.0007-2.el5
[root@poller1 mysql]# rpm -ev --allmatches mysql-5.0.95-5.el5_9
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[root@poller1 mysql]# rpm -qa | grep -i mysql
mysql-connector-odbc-3.51.30-0
You have new mail in /var/spool/mail/root
Download MySQL 5.1.73 prepare for installation:
In Generally Available(GA) Releasestab, Select version 5.1.73and select Platform: your OS'version, I choose Red Hat Enterprise Linux/ Oracle Linux. Here, you see a list file for download, I get file Red Hat Enterprise Linux 5 / Oracle Linux 5 (x86, 64-bit), RPM Bundle(MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar), click Download. You have to login with Oracle Account to download.
Prepare installing Directory:
[root@poller1 ~]# mkdir mysql
[root@poller1 ~]# cd mysql
[root@poller1 mysql]# ls
Transfer installing data to installation directory:
Because I access server via command line (ssh), so I need download file from my computer then transfer data to server.
[root@poller1 mysql]# scp root@192.168.2.133:/root/Downloads/MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar .
root@192.168.2.133's password:
***********
MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar 100% 156MB 11.2MB/s 00:14
Installing MySQL 5.1.73
Extracting downloaded file to your installing directory:[root@poller1 mysql]# tar -xvpf MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar
MySQL-community-debuginfo-5.1.73-1.rhel5.x86_64.rpm
MySQL-embedded-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-shared-compat-5.1.73-1.rhel5.x86_64.rpm
MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-shared-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-test-community-5.1.73-1.rhel5.x86_64.rpm
[root@poller1 mysql]#
Install MySQL client-server:
[root@poller1 mysql]# rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [ 50%]
Giving mysqld 5 seconds to exit nicely
2:MySQL-server-community ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h poller1 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
Starting MySQL.[ OK ]
Giving mysqld 2 seconds to start
Install the “Header and Libraries” that are part of the MySQL-devel packages.
[root@poller1 mysql]# rpm -ivh MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]
You have new mail in /var/spool/mail/root
[root@poller1 mysql]#
At a bare minimum you should set a password for the root user as shown below:
[root@poller1 mysql]# /usr/bin/mysqladmin -u root password '***********'
You have new mail in /var/spool/mail/root
Editing the MySQL Server configuration file:
[root@poller1 etc]# cp my.cnf.rpmnew my.cnf
You have new mail in /var/spool/mail/root
[root@poller1 etc]# vim /etc/my.cnf
[mysqld]
port = 3306
datadir=/var/lib/mysql
log-bin=/var/lib/mysql/poller1-bin
max_binlog_size=4096
binlog_format=row
socket=/tmp/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port = 3306
socket=/tmp/mysql.sock
Restarting MySQL Server:
[root@poller1 etc]# service mysql restart
Shutting down MySQL... [ OK ]
Starting MySQL. [ OK ]
Login your new MySQL 5.1:
[root@poller1 etc]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 64
Server version: 5.1.73-community-log MySQL Community Server (GPL)
Copyright (c) 2000, 2010, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> create database AMDB;
Query OK, 1 row affected (0.02 sec)
Create database AMDB;
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql>
0 komentar:
Post a Comment