久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

MySQL 5.5.25如何安裝及升級到5.6.26 for RedHat Enterprise Linux 6.4

148次閱讀
沒有評論

共計 15036 個字符,預(yù)計需要花費 38 分鐘才能閱讀完成。

這篇文章將為大家詳細(xì)講解有關(guān) MySQL 5.5.25 如何安裝及升級到 5.6.26 for RedHat Enterprise Linux 6.4,丸趣 TV 小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

步驟一:準(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 包名(都地上面顯示)來清除安裝包,如果碰到不能報錯不能刪除,加上參數(shù) –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 和數(shù)據(jù)庫文件 /var/lib/mysql,保守起見可將配置文件 my.cnf 進行改名處理。
 

步驟二:
 
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 安裝時會報如下錯誤:
在 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* 就會報錯,若你想連 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

以下為報錯信息:
[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
…………………………………………………

即使你使用如下安裝方法安裝也會報錯:

[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 // 校驗字符
-DEXTRA_CHARSETS=all // 安裝所有擴展字符集
-DENABLED_LOCAL_INFILE=1 // 允許從本地導(dǎo)入數(shù)據(jù)
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
 
 
注意事項:
如安裝失敗重新編譯時,需要清除舊的對象文件和緩存信息。
shell make clean
shell rm -f CMakeCache.txt
shell rm -rf /etc/my.cnf
 
 
9、設(shè)置開機自動啟動及創(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è)置開機自動啟動:
[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é)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-07-27發(fā)表,共計15036字。
轉(zhuǎn)載說明:除特殊說明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 浦北县| 台山市| 达孜县| 武威市| 团风县| 安徽省| 咸丰县| 齐河县| 禹城市| 当涂县| 中卫市| 龙门县| 托克托县| 丰宁| 比如县| 石狮市| 威远县| 新乡县| 乳源| 武强县| 焦作市| 清丰县| 双流县| 若尔盖县| 淳化县| 唐山市| 固阳县| 宁德市| 怀宁县| 九台市| 苏尼特右旗| 阜康市| 探索| 绵竹市| 吉安县| 银川市| 留坝县| 京山县| 搜索| 高唐县| 崇文区|