您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)MySQL 5.5.25如何安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4,小編覺得挺實(shí)用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
步驟一:準(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@mysql01 Desktop]# 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 包名 (都地上面顯示)來清除安裝包,如果碰到不能報(bào)錯不能刪除,加上參數(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
直到下面語句找不到mysql包為止
[root@mysql01 ~]# rpm -qa | grep mysql
注意:在卸載完成之后需要刪除配置文件/etc/my.cnf和數(shù)據(jù)庫文件/var/lib/mysql ,保守起見可將配置文件my.cnf進(jìn)行改名處理。
步驟二:
1、檢查及安裝所需要的包
[root@mysql01 ~]# rpm -qa | grep cmake
cmake-2.6.4-5.el6.x86_64
[root@mysql01 ~]# rpm -qa | grep make
cmake-2.6.4-5.el6.x86_64
automake-1.11.1-4.el6.noarch
imake-1.0.2-11.el6.x86_64
make-3.81-20.el6.x86_64
makebootfat-1.4-10.el6.x86_64
[root@mysql01 ~]# yum install gcc gcc-c++ autoconf automake bison* zlib* libxml* ncurses-devel libaio* make cmake -y //如果加測沒有安裝make、cmake包需要安裝
2、安裝libtool-ltdl-devel包(libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm、libtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm)
[root@mysql01 ~]# cd /misc/cd/Packages
[root@mysql01 Packages]# ls -l libtool-ltdl*
-r--r--r--. 144 root root 45660 Aug 17 2010 libtool-ltdl-2.2.6-15.5.el6.i686.rpm
-r--r--r--. 109 root root 45460 Aug 17 2010 libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm
-r--r--r--. 37 root root 166264 Aug 17 2010 libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm
-r--r--r--. 34 root root 166248 Aug 17 2010 libtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm
[root@mysql01 Packages]# rpm -ivh libtool-ltdl-2.2.6-15.5.el6.i686.rpm
warning: libtool-ltdl-2.2.6-15.5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libtool-ltdl ########################################### [100%]
[root@mysql01 Packages]# rpm -ivh libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm //安裝這個包之前先安裝rpm -ivh libtool-ltdl-2.2.6-15.5.el6.i686.rpm
warning: libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libtool-ltdl-devel ########################################### [100%]
[root@mysql01 Packages]# rpm -ivh libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm
warning: libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libtool-ltdl-devel ########################################### [100%]
備注:
筆者在很多地方看到MySQL時使用的是libtool-ltdl-devel*,在使用yum安裝時會報(bào)如下錯誤:
在MySQL的安裝過程中,libtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm可以用rpm -ivh libtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm方式安裝,
但是用yum install libtool-ltdl-devel*就會報(bào)錯,若你想連libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm一起裝安裝,就必須先安裝
libtool-ltdl-2.2.6-15.5.el6.i686.rpm包,然后才能安裝rpm -ivh libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm
以下為報(bào)錯信息:
[root@mysql01 ~]# yum install gcc gcc-c++ autoconf automake bison* zlib* libxml* ncurses-devel libaio* libtool-ltdl-devel* make cmake -y
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, refresh-packagekit, security, subscription-manager, tmprepo,
: verify, versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Setting up Install Process
Package gcc-4.4.7-3.el6.x86_64 already installed and latest version
Package gcc-c++-4.4.7-3.el6.x86_64 already installed and latest version
............................................
Package ncurses-devel-5.7-3.20090208.el6.x86_64 already installed and latest version
No package libtool-ltdl-devel* available.
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
.........................................................
即使你使用如下安裝方法安裝也會報(bào)錯:
[root@mysql01 ~]# yum install libtool-ltdl-devel* -y
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, refresh-packagekit,
: security, subscription-manager, tmprepo, verify, versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Setting up Install Process
No package libtool-ltdl-devel* available.
Error: Nothing to do
[root@mysql01 ~]# yum install libtool-ltdl-devel-2.2.6-15.5.el6.i686* -y
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, refresh-packagekit, security, subscription-manager, tmprepo,
: verify, versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Setting up Install Process
No package libtool-ltdl-devel-2.2.6-15.5.el6.i686* available.
Error: Nothing to do
[root@mysql01 ~]# rpm -ivh /misc/cd/Packages/libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm
warning: /misc/cd/Packages/libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
libltdl.so.7 is needed by libtool-ltdl-devel-2.2.6-15.5.el6.i686
3、建立用戶組及用戶
[root@mysql01 ~]# groupadd mysql
[root@mysql01 ~]# useradd -g mysql mysql
4、設(shè)置操作系統(tǒng)資源限制
[root@mysql01 ~]# vi /etc/security/limits.conf //在配置文件最末尾添加如下內(nèi)容
mysql soft nproc 2047
mysql hard nproc 16384
mysql soft nofile 1024
mysql hard nofile 65536
5、將下載好的mysql程序rpm包上傳至服務(wù)器
此處略過
6、創(chuàng)建mysql的安裝目錄及數(shù)據(jù)庫存放目錄并設(shè)置權(quán)限
[root@mysql01 ~]# mkdir -p /usr/local/mysql
[root@mysql01 ~]# mkdir -p /usr/local/mysql/data
[root@mysql01 ~]# chown -R mysql:mysql /usr/local/mysql/
7、解壓上傳好mysql源文件
[root@mysql01 ~]# cd Desktop
[root@mysql01 Desktop]# tar -xzvf mysql-5.6.25.tar.gz -C /usr/local/mysql
[root@mysql01 Desktop]# chown -R mysql:mysql /usr/local/mysql/
8、執(zhí)行cmake命令,生成編譯配置文件
[root@mysql01 ~]# cd /usr/local/mysql/mysql-5.6.25/
[root@mysql01 mysql-5.6.25]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DINSTALL_DATADIR=/usr/local/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1
[root@mysql01 mysql-5.6.25]# make && make install
備注:
1、此編譯安裝過程耗時較慢,可能耗時5-10分鐘左右,需要大家耐心等待.
2、CMAKE參數(shù)說明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //默認(rèn)安裝目錄
-DINSTALL_DATADIR=/usr/local/mysql/data //數(shù)據(jù)庫存放目錄
-DDEFAULT_CHARSET=utf8 //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci //校驗(yàn)字符
-DEXTRA_CHARSETS=all //安裝所有擴(kuò)展字符集
-DENABLED_LOCAL_INFILE=1 //允許從本地導(dǎo)入數(shù)據(jù)
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
注意事項(xiàng):
如安裝失敗重新編譯時,需要清除舊的對象文件和緩存信息。
shell> make clean
shell> rm -f CMakeCache.txt
shell> rm -rf /etc/my.cnf
9、設(shè)置開機(jī)自動啟動及創(chuàng)建系統(tǒng)數(shù)據(jù)庫的表
[root@mysql01 ~]# cp /usr/local/mysql/mysql-5.6.25/support-files/my-default.cnf /etc/my.cnf
[root@mysql01 ~]# cp /usr/local/mysql/mysql-5.6.25/support-files/mysql.server /etc/rc.d/init.d/mysql //將mysql的啟動服務(wù)添加到系統(tǒng)服務(wù)中
10、安裝mysql數(shù)據(jù)庫:
[root@mysql01 ~]# chmod +x /usr/local/mysql/mysql-5.6.25/scripts/mysql_install_db*
[root@mysql01 ~]# /usr/local/mysql/mysql-5.6.25/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
或者:
[root@mysql01 ~]# /usr/local/mysql/mysql-5.6.25/scripts/mysql_install_db.sh --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
或者:
[root@mysql01 scripts]# ./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
Installing MySQL system tables...2016-01-12 14:16:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-12 14:16:46 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.25) starting as process 4236 ...
2016-01-12 14:16:46 4236 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-01-12 14:16:46 4236 [Note] InnoDB: The InnoDB memory heap is disabled
2016-01-12 14:16:46 4236 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-01-12 14:16:46 4236 [Note] InnoDB: Memory barrier is not used
2016-01-12 14:16:46 4236 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-01-12 14:16:46 4236 [Note] InnoDB: Using Linux native AIO
2016-01-12 14:16:46 4236 [Note] InnoDB: Using CPU crc32 instructions
2016-01-12 14:16:46 4236 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-01-12 14:16:46 4236 [Note] InnoDB: Completed initialization of buffer pool
2016-01-12 14:16:46 4236 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-01-12 14:16:46 4236 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-01-12 14:16:46 4236 [Note] InnoDB: Database physically writes the file full: wait...
2016-01-12 14:16:46 4236 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-01-12 14:16:47 4236 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-01-12 14:16:48 4236 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-01-12 14:16:48 4236 [Warning] InnoDB: New log files created, LSN=45781
2016-01-12 14:16:48 4236 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-01-12 14:16:48 4236 [Note] InnoDB: Doublewrite buffer created
2016-01-12 14:16:48 4236 [Note] InnoDB: 128 rollback segment(s) are active.
2016-01-12 14:16:48 4236 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-01-12 14:16:48 4236 [Note] InnoDB: Foreign key constraint system tables created
2016-01-12 14:16:48 4236 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-01-12 14:16:48 4236 [Note] InnoDB: Tablespace and datafile system tables created.
2016-01-12 14:16:48 4236 [Note] InnoDB: Waiting for purge to start
2016-01-12 14:16:48 4236 [Note] InnoDB: 5.6.25 started; log sequence number 0
2016-01-12 14:16:49 4236 [Note] Binlog end
2016-01-12 14:16:49 4236 [Note] InnoDB: FTS optimize thread exiting.
2016-01-12 14:16:49 4236 [Note] InnoDB: Starting shutdown...
2016-01-12 14:16:51 4236 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2016-01-12 14:16:51 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-12 14:16:51 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.25) starting as process 4260 ...
2016-01-12 14:16:51 4260 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-01-12 14:16:51 4260 [Note] InnoDB: The InnoDB memory heap is disabled
2016-01-12 14:16:51 4260 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-01-12 14:16:51 4260 [Note] InnoDB: Memory barrier is not used
2016-01-12 14:16:51 4260 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-01-12 14:16:51 4260 [Note] InnoDB: Using Linux native AIO
2016-01-12 14:16:51 4260 [Note] InnoDB: Using CPU crc32 instructions
2016-01-12 14:16:51 4260 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-01-12 14:16:51 4260 [Note] InnoDB: Completed initialization of buffer pool
2016-01-12 14:16:51 4260 [Note] InnoDB: Highest supported file format is Barracuda.
2016-01-12 14:16:51 4260 [Note] InnoDB: 128 rollback segment(s) are active.
2016-01-12 14:16:51 4260 [Note] InnoDB: Waiting for purge to start
2016-01-12 14:16:51 4260 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2016-01-12 14:16:51 4260 [Note] Binlog end
2016-01-12 14:16:51 4260 [Note] InnoDB: FTS optimize thread exiting.
2016-01-12 14:16:51 4260 [Note] InnoDB: Starting shutdown...
2016-01-12 14:16:53 4260 [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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h mysql01 password 'new-password'
Alternatively you can run:
/usr/local/mysql/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 . ; /usr/local/mysql/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 /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
11、啟動mysql數(shù)據(jù)庫并設(shè)置開機(jī)自動啟動:
[root@mysql01 ~]# service mysql start
env: /etc/init.d/mysql: Permission denied
[root@mysql01 ~]# ls -l /etc/init.d/mysql
-rw-r--r--. 1 root root 10880 Aug 28 21:24 /etc/init.d/mysql
[root@mysql01 ~]# chmod 755 /etc/init.d/mysql
[root@mysql01 ~]# ls -l /etc/init.d/mysql
-rwxr-xr-x. 1 root root 10880 Aug 28 21:24 /etc/init.d/mysql
[root@mysql01 ~]# service mysql status
MySQL is not running [FAILED]
[root@mysql01 ~]# service mysql start
Starting MySQL.. [ OK ]
[root@mysql01 Desktop]# chkconfig --list | grep mysql
[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
12、將mysql的啟動服務(wù)添加到系統(tǒng)服務(wù)中
[root@mysql01 ~]# vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
[root@mysql01 ~]# source /root/.bash_profile
或者:
[root@mysql01 ~]# . .bash_profile
13、登錄測試:
[root@mysql01 ~]# mysql -uroot -p
Enter password: //密碼為空
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25 Source distribution
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> set password for root@'localhost'=password("666666");
Query OK, 0 rows affected (0.04 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| t |
+--------------------+
4 rows in set (0.03 sec)
mysql> select user,host from mysql.user order by user;
+------+-----------+
| user | host |
+------+-----------+
| | localhost |
| | mysql01 |
| root | localhost |
| root | mysql01 |
| root | 127.0.0.1 |
| root | ::1 |
+------+-----------+
6 rows in set (0.01 sec)
mysql> exit
Bye
[root@mysql01 ~]# mysql -uroot -p
Enter password:666666
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25 Source distribution
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 |
| mysq |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
關(guān)于“MySQL 5.5.25如何安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。