MySQL5.1怎么在CentOS系統(tǒng)中升級(jí)至5.5.36的示例詳細(xì)說(shuō)明
發(fā)表時(shí)間:2023-07-26 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]有相關(guān)測(cè)試數(shù)據(jù)說(shuō)明從5.1到5.5+,MySQL性能會(huì)有明顯的提升,具體的需要自己建立測(cè)試環(huán)境去實(shí)踐下,今天我們就來(lái)操作下,并記錄下來(lái)升級(jí)的具體步驟記錄下CentOS 6.4環(huán)境將MySQL5.1升...
有相關(guān)測(cè)試數(shù)據(jù)說(shuō)明從5.1到5.5+,MySQL性能會(huì)有明顯的提升,具體的需要自己建立測(cè)試環(huán)境去實(shí)踐下,今天我們就來(lái)操作下,并記錄下來(lái)升級(jí)的具體步驟
記錄下CentOS 6.4環(huán)境將MySQL5.1升級(jí)至5.5.36的過(guò)程,希望對(duì)大家有個(gè)參考。
1.為了安全期間,首先需要備份原有數(shù)據(jù)
2.卸載原有MySQL,先停止原有的MySQL服務(wù),再查找 find / -name mysql
[root@linuxidc /]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql
并移除服務(wù)
[root@linuxidc /]# rm -rf /var/lib/mysql
[root@linuxidc /]# rm -rf /var/lib/mysql
[root@linuxidc /]# rm -rf /usr/lib64/mysql
3.安裝cmake
[root@linuxidc download]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[root@linuxidc download]# tarx zvfc cmake-2.8.12.2.tar.gz
[root@linuxidc download]# cd cmake-2.8.12.2
[root@linuxidc cmake-2.8.12.2]# ./configure
[root@linuxidc cmake-2.8.12.2]# make && make install
4.下載安裝MySQL5.5.36
[root@linuxidc download]# wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz
[root@linuxidc download]# tar xzvf mysql-5.5.36.tar.gz
[root@linuxidc download]# cd mysql-5.5.36
[root@linuxidc mysql-5.5.36]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/home/mysql
[root@linuxidc mysql-5.5.36]# make && make install
在cmake的過(guò)程中出錯(cuò)了,提示Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
執(zhí)行以下代碼就可以了,執(zhí)行好之后繼續(xù)cmake,然后再make && make install
[root@localhost mysql-5.5.36]# rm CMakeCache.txt
[root@localhost mysql-5.5.36]# yum install ncurses-devel
5.接下來(lái)需要把之前備份下來(lái)的my.cnf文件,復(fù)制至/etc/my.cnf
MySQL會(huì)讀取/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf /.my.cnf。左邊的文件優(yōu)先級(jí)是最高的
6.配置好之后,我們就啟動(dòng)mysql,發(fā)現(xiàn)有一個(gè)問(wèn)題啟動(dòng)MySQL提示:The server quit without updating PID file(…)失敗
查看my.cnf文件設(shè)置的日記文件地址/var/log/mysqld.log,錯(cuò)誤提示如下
170715 12:31:36 mysqld_safe mysqld from pid file /var/lib/mysql/linuxidc.pid ended
170715 12:57:48 mysqld_safe Starting mysqld daemon with databases from /home/mysql
170715 12:57:48 InnoDB: The InnoDB memory heap is disabled
170715 12:57:48 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170715 12:57:48 InnoDB: Compressed tables use zlib 1.2.3
170715 12:57:48 InnoDB: Initializing buffer pool, size = 128.0M
170715 12:57:48 InnoDB: Completed initialization of buffer pool
170715 12:57:48 InnoDB: highest supported file format is Barracuda.
170715 12:57:48 InnoDB: Waiting for the background threads to start
170715 12:57:49 InnoDB: 5.5.36 started; log sequence number 2645823
170715 12:57:49 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'default-character-set=utf8'
170715 12:57:49 [ERROR] Aborting
此報(bào)錯(cuò)是由/etc/my.cnf配置文件下的[mysqld]設(shè)置字符集引起的,解決方法:將default-character-set=utf8 改為 character_set_server=utf8
7.通過(guò)mysql -u root -p命令連接mysql。(我們之前有安裝過(guò)mysql,數(shù)據(jù)庫(kù)文件還在,所以不需要再添加用戶設(shè)置權(quán)限了)
出現(xiàn)了錯(cuò)誤信息:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
出錯(cuò)原因是我們mysql.sock文件在/usr/lib/mysql/文件夾下
可以嘗試通過(guò)下面命令連接,并查看mysql版本
[root@linuxidc var]# mysql -u root -p -S /usr/lib/mysql/mysql.sock
mysql> select version();
+-----------+
version()
+-----------+
5.5.36
+-----------+
1 row in set (0.00 sec)
以上就是MySQL5.1如何在CentOS系統(tǒng)中升級(jí)至5.5.36的示例詳解的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注php中文網(wǎng)其它相關(guān)文章!
學(xué)習(xí)教程快速掌握從入門(mén)到精通的SQL知識(shí)。