您好,登錄后才能下訂單哦!
小編給大家分享一下MySQL 5.5.25如何使用rpm安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
環境:RedHat Enterprise Linux 6.4(x86_64) MySQL:5.6.25
RPM包安裝方法:
步驟一:準備工作:
1、建議刪除系統存在的mysql用戶
[root@mysql01 Desktop]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)
[root@mysql01 Desktop]# userdel -r mysql
2、清理已安裝的mysql程序包
[root@mysql01 Desktop]# service mysql status
[root@mysql01 Desktop]# service mysql stop
[root@mysql01 Desktop]# service mysql status
[root@suzzy ~]# rpm -qa|grep mysql
mysql-server-5.1.66-2.el6_3.x86_64
dovecot-mysql-2.0.9-5.el6.x86_64
qt-mysql-4.6.2-25.el6.x86_64
rsyslog-mysql-5.8.10-6.el6.x86_64
mysql-5.1.66-2.el6_3.x86_64
mod_auth_mysql-3.0.0-11.el6_0.1.x86_64
mysql-devel-5.1.66-2.el6_3.x86_64
mysql-libs-5.1.66-2.el6_3.x86_64
使用rpm -e來刪除已經安裝的mysql包,如果碰到不能報錯不能刪除,加上參數 --nodeps強制刪除即可。
例如:
[root@suzzy ~]# rpm -e qt-mysql-4.6.2-25.el6.x86_64
error: Failed dependencies:
qt4-mysql is needed by (installed) akonadi-1.2.1-2.el6.x86_64
[root@suzzy ~]# rpm -e qt-mysql-4.6.2-25.el6.x86_64 --nodeps
rpm -e mysql-server-5.1.66-2.el6_3.x86_64 --nodeps
rpm -e dovecot-mysql-2.0.9-5.el6.x86_64 --nodeps
rpm -e qt-mysql-4.6.2-25.el6.x86_64 --nodeps
rpm -e rsyslog-mysql-5.8.10-6.el6.x86_64 --nodeps
rpm -e mysql-5.1.66-2.el6_3.x86_64 --nodeps
rpm -e mod_auth_mysql-3.0.0-11.el6_0.1.x86_64 --nodeps
rpm -e mysql-devel-5.1.66-2.el6_3.x86_64 --nodeps
rpm -e mysql-libs-5.1.66-2.el6_3.x86_64 --nodeps
直到執行下面語句找不到mysql包為止
[root@mysql01 ~]# rpm -qa | grep mysql
注意:在卸載完成之后需要刪除配置文件/etc/my.cnf和數據庫文件/var/lib/mysql ,保守起見可將配置文件my.cnf進行改名處理。
步驟二:開始安裝
1、建立用戶組及用戶
[root@mysql01 ~]# groupadd mysql
[root@mysql01 ~]# useradd -g mysql mysql
2、將下載好的mysql程序rpm包上傳至服務器
此處略過
[root@mysql01 Desktop]# unzip V76360-01.zip
[root@mysql01 Desktop]# rpm -ivh MySQL-*
Preparing... ########################################### [100%]
1:MySQL-devel-advanced ########################################### [ 14%]
2:MySQL-client-advanced ########################################### [ 29%]
3:MySQL-test-advanced ########################################### [ 43%]
4:MySQL-embedded-advanced########################################### [ 57%]
5:MySQL-shared-compat-adv########################################### [ 71%]
6:MySQL-shared-advanced ########################################### [ 86%]
7:MySQL-server-advanced ########################################### [100%]
2015-08-28 10:56:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-08-28 10:56:58 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 4981 ...
2015-08-28 10:56:58 4981 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-28 10:56:58 4981 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-28 10:56:58 4981 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-28 10:56:58 4981 [Note] InnoDB: Memory barrier is not used
2015-08-28 10:56:58 4981 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-28 10:56:58 4981 [Note] InnoDB: Using Linux native AIO
2015-08-28 10:56:58 4981 [Note] InnoDB: Using CPU crc32 instructions
2015-08-28 10:56:58 4981 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-28 10:56:58 4981 [Note] InnoDB: Completed initialization of buffer pool
2015-08-28 10:56:58 4981 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-08-28 10:56:58 4981 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-08-28 10:56:58 4981 [Note] InnoDB: Database physically writes the file full: wait...
2015-08-28 10:56:59 4981 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-08-28 10:57:00 4981 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-08-28 10:57:01 4981 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-08-28 10:57:01 4981 [Warning] InnoDB: New log files created, LSN=45781
2015-08-28 10:57:01 4981 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-08-28 10:57:01 4981 [Note] InnoDB: Doublewrite buffer created
2015-08-28 10:57:01 4981 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-28 10:57:01 4981 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-08-28 10:57:02 4981 [Note] InnoDB: Foreign key constraint system tables created
2015-08-28 10:57:02 4981 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-08-28 10:57:02 4981 [Note] InnoDB: Tablespace and datafile system tables created.
2015-08-28 10:57:02 4981 [Note] InnoDB: Waiting for purge to start
2015-08-28 10:57:02 4981 [Note] InnoDB: 5.6.25 started; log sequence number 0
2015-08-28 10:57:02 4981 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2015-08-28 10:57:02 4981 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
A random root password has been set. You will find it in '/root/.mysql_secret'.
2015-08-28 10:57:03 4981 [Note] Binlog end
2015-08-28 10:57:03 4981 [Note] InnoDB: FTS optimize thread exiting.
2015-08-28 10:57:03 4981 [Note] InnoDB: Starting shutdown...
2015-08-28 10:57:04 4981 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2015-08-28 10:57:04 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-08-28 10:57:04 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 5006 ...
2015-08-28 10:57:04 5006 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-28 10:57:04 5006 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-28 10:57:04 5006 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-28 10:57:04 5006 [Note] InnoDB: Memory barrier is not used
2015-08-28 10:57:04 5006 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-28 10:57:04 5006 [Note] InnoDB: Using Linux native AIO
2015-08-28 10:57:04 5006 [Note] InnoDB: Using CPU crc32 instructions
2015-08-28 10:57:04 5006 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-28 10:57:04 5006 [Note] InnoDB: Completed initialization of buffer pool
2015-08-28 10:57:04 5006 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-28 10:57:04 5006 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-28 10:57:04 5006 [Note] InnoDB: Waiting for purge to start
2015-08-28 10:57:04 5006 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2015-08-28 10:57:04 5006 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2015-08-28 10:57:04 5006 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2015-08-28 10:57:04 5006 [Note] Binlog end
2015-08-28 10:57:04 5006 [Note] InnoDB: FTS optimize thread exiting.
2015-08-28 10:57:04 5006 [Note] InnoDB: Starting shutdown...
2015-08-28 10:57:06 5006 [Note] InnoDB: Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
[root@mysql01 Desktop]# cat /root/.mysql_secret
# The random password set for the root user at Fri Aug 28 10:57:02 2015 (local time): FY2X3PPff8VzaEn5
3、配置并啟動mysql及設置開機自動啟動
[root@mysql01 Desktop]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
[root@mysql01 Desktop]# ls -l /etc/my.cnf
-rwxr-xr-x. 1 root root 1126 Aug 28 11:09 /etc/my.cnf
[root@mysql01 Desktop]# ps -ef | grep mysql
root 5369 5167 0 11:10 pts/1 00:00:00 grep mysql
[root@mysql01 Desktop]# service mysql start
Starting MySQL.. [ OK ]
[root@mysql01 Desktop]# service mysql status
MySQL running (5507) [ OK ]
[root@mysql01 Desktop]# chkconfig --list | grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
備注:如2、3、4為off,即mysql未設置為開機自動啟動,可以使用如下方法設置
[root@mysql01 Desktop]# chkconfig --list | grep mysql
mysql 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@mysql01 Desktop]# chkconfig --level 2345 mysql on
[root@mysql01 Desktop]# chkconfig --list | grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4、登錄系統:
[root@mysql01 ~]# mysql -uroot -p
Enter password: //密碼為空
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.25-enterprise-commercial-advanced
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> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> set password for root@'localhost'=password("66666");
Query OK, 0 rows affected (0.10 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.14 sec)
mysql> exit
Bye
備注:
MySQL 5.6版本之前,默認安裝的數據庫是可以直接連接,五需密碼的,而進入5.6版本,建庫后數據庫管理員賬戶(即root)
默認就會有密碼保護,并且初始密碼設置也很嚴格,這也說明進入5.6版本后,在安全性設置方面有一定提高
[root@mysql01 ~]# mysql -uroot -p
Enter password:666666
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.25-enterprise-commercial-advanced
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.14 sec)
步驟三:升級
MySQL 5.6.25升級到5.6.26
升級安裝:
1、停服務
[root@mysql01 Desktop]# service mysql status
[root@mysql01 Desktop]# service mysql stop
[root@mysql01 Desktop]# service mysql status
2、備份數據文件
[root@mysql01 Desktop]# mkdir /tmp/mbackup
[root@mysql01 Desktop]# cp /usr/my.cnf /tmp/mbackup -a
[root@mysql01 Desktop]# mkdir /tmp/mbackup/data
[root@mysql01 Desktop]# cp -rp /var/lib/mysql/* /tmp/mbackup/data
3、解壓縮升級版本安裝源
[root@mysql01 Desktop]# unzip V77245-01.zip
[root@mysql01 Desktop]# rpm -ivh MySQL-*-5.6.26-* --replacefiles
4、升級后更新數據字典
[root@mysql01 Desktop]# service mysql status
MySQL is not running [FAILED]
[root@mysql01 Desktop]# service mysql start
Starting MySQL... [ OK ]
[root@mysql01 Desktop]# service mysql status
MySQL running (19134) [ OK ]
[root@mysql01 Desktop]# /usr/bin/mysql_upgrade -S /var/lib/mysql/mysql.sock -uroot -p666666 //操作前一定要確保mysql服務處于啟動狀態
Warning: Using a password on the command line interface can be insecure.
Looking for 'mysql' as: /usr/bin/mysql
Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Running 'mysqlcheck' with connection arguments: '--socket=/var/lib/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--socket=/var/lib/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--socket=/var/lib/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--socket=/var/lib/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
OK
5、檢查確認
[root@mysql01 ~]# mysql -uroot -p
Enter password:666666
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.25-enterprise-commercial-advanced
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> select version();
+---------------------------------------+
| version() |
+---------------------------------------+
| 5.6.26-enterprise-commercial-advanced |
+---------------------------------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mydata |
| mysql |
| performance_schema |
| test |
| test_db |
+--------------------+
6 rows in set (0.00 sec)
看完了這篇文章,相信你對“MySQL 5.5.25如何使用rpm安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。