共計(jì) 11187 個(gè)字符,預(yù)計(jì)需要花費(fèi) 28 分鐘才能閱讀完成。
行業(yè)資訊
數(shù)據(jù)庫(kù)
MySQL 數(shù)據(jù)庫(kù)
MySQL 5.5.25 如何使用 tar 安裝及升級(jí)到 5.6.26 for RedHat Enterprise Linux 6.4
這篇文章將為大家詳細(xì)講解有關(guān) MySQL 5.5.25 如何使用 tar 安裝及升級(jí)到 5.6.26 for RedHat Enterprise Linux 6.4,丸趣 TV 小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
步驟一:準(zhǔn)備工作:
1、建議刪除系統(tǒng)存在的 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 包名(都地上面顯示)來(lái)清除安裝包,如果碰到不能報(bào)錯(cuò)不能刪除,加上參數(shù) –nodeps 強(qiáng)制刪除即可。
例如:
[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
直到下面語(yǔ)句找不到 mysql 包為止
[root@mysql01 ~]# rpm -qa | grep mysql
注意:在卸載完成之后需要?jiǎng)h除配置文件 /etc/my.cnf 和數(shù)據(jù)庫(kù)文件 /var/lib/mysql,保守起見(jiàn)可將配置文件 my.cnf 進(jìn)行改名處理。
步驟二:開(kāi)始安裝
1、建立用戶組及用戶
[root@mysql01 ~]# groupadd mysql
[root@mysql01 ~]# useradd -g mysql mysql
2、將下載好的 mysql 程序 rpm 包上傳至服務(wù)器
此處略過(guò)
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. 將解壓后的文件夾移動(dòng)到 /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. 復(fù)制 my-default.cnf 為 my.cnf
[root@mysql01 Desktop]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
7. 初試化表并且規(guī)定用 mysql 用戶來(lái)訪問(wèn)
[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. 設(shè)定用戶訪問(wèn)權(quán)限與啟動(dòng),登錄測(cè)試
[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 版本之前,默認(rèn)安裝的數(shù)據(jù)庫(kù)是可以直接連接,五需密碼的,而進(jìn)入 5.6 版本,建庫(kù)后數(shù)據(jù)庫(kù)管理員賬戶(即 root)
默認(rèn)就會(huì)有密碼保護(hù),并且初始密碼設(shè)置也很?chē)?yán)格,這也說(shuō)明進(jìn)入 5.6 版本后,在安全性設(shè)置方面有一定提高
[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 復(fù)制到 /etc/init.d 下,進(jìn)行啟動(dòng)停止服務(wù)測(cè)試
[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. 設(shè)置環(huán)境變量中的 PATH,這樣就可以直接使用 mysql 相關(guān)命令
[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)
關(guān)于“MySQL 5.5.25 如何使用 tar 安裝及升級(jí)到 5.6.26 for RedHat Enterprise Linux 6.4”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。