您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關MySQL 5.5.25如何使用tar安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
步驟一:準備工作:
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 包名 (都地上面顯示)來清除安裝包,如果碰到不能報錯不能刪除,加上參數 --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包上傳至服務器
此處略過
3. 解壓縮mysql程序包
[root@mysql01 Desktop]# unzip V76366-01.zip
[root@mysql01 Desktop]# tar -zxvf mysql-advanced-5.6.22-linux-glibc2.5-x86_64.tar.gz
4. 將解壓后的文件夾移動到/usr/local下并改名為mysql
[root@mysql01 Desktop]# mv mysql-advanced-5.6.25-linux-glibc2.5-x86_64 /usr/local/mysql
5. 建立mysql組,建立mysql用戶并且加入到mysql組中
[root@mysql01 Desktop]# groupadd mysql
[root@mysql01 Desktop]# useradd mysql -g mysql
6. 復制my-default.cnf為my.cnf
[root@mysql01 Desktop]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
7. 初試化表并且規定用mysql用戶來訪問
[root@mysql01 Desktop]# cd /usr/local/mysql
[root@mysql01 mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2015-08-28 18:20:22 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 18:20:22 0 [Note] ./bin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 10702 ...
2015-08-28 18:20:22 10702 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-28 18:20:22 10702 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-28 18:20:22 10702 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-28 18:20:22 10702 [Note] InnoDB: Memory barrier is not used
2015-08-28 18:20:22 10702 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-28 18:20:22 10702 [Note] InnoDB: Using Linux native AIO
2015-08-28 18:20:22 10702 [Note] InnoDB: Using CPU crc32 instructions
2015-08-28 18:20:22 10702 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-28 18:20:22 10702 [Note] InnoDB: Completed initialization of buffer pool
2015-08-28 18:20:22 10702 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-08-28 18:20:22 10702 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-08-28 18:20:22 10702 [Note] InnoDB: Database physically writes the file full: wait...
2015-08-28 18:20:22 10702 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-08-28 18:20:23 10702 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-08-28 18:20:24 10702 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-08-28 18:20:24 10702 [Warning] InnoDB: New log files created, LSN=45781
2015-08-28 18:20:24 10702 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-08-28 18:20:24 10702 [Note] InnoDB: Doublewrite buffer created
2015-08-28 18:20:24 10702 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-28 18:20:24 10702 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-08-28 18:20:24 10702 [Note] InnoDB: Foreign key constraint system tables created
2015-08-28 18:20:24 10702 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-08-28 18:20:24 10702 [Note] InnoDB: Tablespace and datafile system tables created.
2015-08-28 18:20:24 10702 [Note] InnoDB: Waiting for purge to start
2015-08-28 18:20:24 10702 [Note] InnoDB: 5.6.25 started; log sequence number 0
2015-08-28 18:20:24 10702 [Note] RSA private key file not found: /usr/local/mysql/data//private_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:24 10702 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:25 10702 [Note] Binlog end
2015-08-28 18:20:25 10702 [Note] InnoDB: FTS optimize thread exiting.
2015-08-28 18:20:25 10702 [Note] InnoDB: Starting shutdown...
2015-08-28 18:20:26 10702 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2015-08-28 18:20:26 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 18:20:26 0 [Note] ./bin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 10725 ...
2015-08-28 18:20:26 10725 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-28 18:20:26 10725 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-28 18:20:26 10725 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-28 18:20:26 10725 [Note] InnoDB: Memory barrier is not used
2015-08-28 18:20:26 10725 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-28 18:20:26 10725 [Note] InnoDB: Using Linux native AIO
2015-08-28 18:20:26 10725 [Note] InnoDB: Using CPU crc32 instructions
2015-08-28 18:20:26 10725 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-28 18:20:26 10725 [Note] InnoDB: Completed initialization of buffer pool
2015-08-28 18:20:26 10725 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-28 18:20:26 10725 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-28 18:20:26 10725 [Note] InnoDB: Waiting for purge to start
2015-08-28 18:20:26 10725 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2015-08-28 18:20:26 10725 [Note] RSA private key file not found: /usr/local/mysql/data//private_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:26 10725 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:27 10725 [Note] Binlog end
2015-08-28 18:20:27 10725 [Note] InnoDB: FTS optimize thread exiting.
2015-08-28 18:20:27 10725 [Note] InnoDB: Starting shutdown...
2015-08-28 18:20:28 10725 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h mysql01 password 'new-password'
Alternatively you can run:
./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.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
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 ./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 mysql]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
8. 設定用戶訪問權限與啟動,登錄測試
[root@mysql01 mysql]# chown -R root .
[root@mysql01 mysql]# chown -R mysql data
[root@mysql01 mysql]# bin/mysqld_safe --user=mysql &
[1] 10860
[root@mysql01 mysql]# 150828 18:25:13 mysqld_safe Logging to '/usr/local/mysql/data/mysql01.err'.
150828 18:25:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@mysql01 mysql]# ps -ef | grep mysql
root 10860 3947 0 18:25 pts/0 00:00:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 10962 10860 1 18:25 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/mysql01.err --pid-file=/usr/local/mysql/data/mysql01.pid
root 11007 3947 0 18:26 pts/0 00:00:00 grep mysql
[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("666666");
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)
9. 將support-files目錄下mysql.server復制到 /etc/init.d下,進行啟動停止服務測試
[root@mysql01 mysql]# cp support-files/mysql.server /etc/init.d
[root@mysql01 mysql]# ls -l /etc/init.d/mysql.server
-rwxr-xr-x. 1 root root 10880 Aug 28 19:07 /etc/init.d/mysql.server
[root@mysql01 mysql]# /etc/init.d/mysql.server stop
Shutting down MySQL..150828 19:08:44 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql01.pid ended
[ OK ]
[1]+ Done bin/mysqld_safe --user=mysql
[root@mysql01 mysql]# /etc/init.d/mysql.server start
Starting MySQL.. [ OK ]
[root@mysql01 mysql]# /etc/init.d/mysql.server status
MySQL running (12316) [ OK ]
10. 設置環境變量中的PATH,這樣就可以直接使用mysql相關命令
[root@mysql01 mysql]# vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
[root@mysql01 ~]# source /root/.bash_profile
或者:
[root@mysql01 ~]# . .bash_profile
[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.5.25如何使用tar安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。