CentOS 5.5下安裝MySQL 5.5全過程分享
打開終端
切換到根目錄
[shell@localhost ~]# su -安裝Mysql5.5之前先卸載CentOS自帶的Mysql5.0。
[root@localhost ~]# yum remove mysql
安裝cmake
下載cmake源碼包cmake-2.8.5.tar.gz
[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz編譯安裝[root@localhost]# tar xzvf cmake-2.8.5.tar.gz [root@localhost]# cd cmake-2.8.5 [root@localhost cmake-2.8.5]# ./bootstrap Error when bootstrapping CMake: Cannot find appropriate C compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted. 報錯:缺少C的編譯器。
解決方法:安裝gcc編譯器
可以從Linux系統(tǒng)的安裝盤中安裝,也可以簡單地用yum安裝
[root@localhost ~]# yum install gcc
繼續(xù)cmake的安裝
[root@localhost cmake-2.8.5]# ./bootstrap Error when bootstrapping CMake: Cannot find appropriate C++ compiler on this system. Please specify one using environment variable CXX. See cmake_bootstrap.log for compilers attempted. 再次報錯:缺少C++編譯器。
安裝gcc-c++編譯器
同樣可以從Linux系統(tǒng)的安裝盤中安裝,或者簡單地用yum安裝
[root@localhost ~]# yum install gcc-c++
重復(fù)上面的操作
[root@localhost cmake-2.8.5]# ./bootstrap
沒有報錯后,編譯安裝
[root@localhost cmake-2.8.5]# make [root@localhost cmake-2.8.5]# make install[root@localhost cmake-2.8.5]# cmake -version
開始正式安裝Mysql
添加mysql用戶和用戶組
[root@localhost ~]# groupadd mysql [root@localhost ~]# useradd -g mysql mysql
下載mysql的源碼包mysql-5.5.27.tar.gz
[root@localhost ~]# wget http://dev.mysql.com/Downloads/MySQL-5.5/mysql-5.5.27.tar.gz解壓
[root@localhost ~]# cd /usr/local/[root@localhost local]# tar xzvf mysql-5.5.27.tar.gz[root@localhost local]# cd mysql-5.5.27
cmake運行
[root@localhost mysql-5.5.27]# cmake .
報錯:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred!
解決辦法:
[root@localhost mysql-5.5.27]# rm CMakeCache.txt [root@localhost mysql-5.5.27]# yum -y install ncurses-devel*
重新cmake運行
[root@localhost mysql-5.5.27]# cmake .還是有個警告
Warning: Bison executable not found in PATH有一個警告,也解決了它,缺少Bison就安裝一下
[root@localhost mysql-5.5.27]# yum install bison
再次運行,沒有報錯
[root@localhost mysql-5.5.27]# cmake .在編譯安裝前,可以設(shè)置安裝的配置選項
[root@localhost mysql-5.5.27]# ./configure --help根據(jù)幫助信息選擇自己需要設(shè)置的選項,當(dāng)然也可以跳過這步,按默認(rèn)設(shè)置
#開始編譯安裝,時間有點稍長...
[root@localhost mysql-5.5.27]# make && make install完成編譯安裝
進入安裝目錄,將程序二進制的所有權(quán)改為root,數(shù)據(jù)目錄的所有權(quán)改為mysql用戶,更新授權(quán)表
[root@localhost mysql-5.5.27]# cd /usr/local/mysql[root@localhost mysql]# chown -R root . [root@localhost mysql]# chown -R mysql . [root@localhost mysql]# chgrp -R mysql . [root@localhost mysql]# scripts/mysql_install_db --user=mysql 初始化數(shù)據(jù)庫[root@localhost mysql]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 安全啟動mysql
[root@localhost mysql]# ./bin/mysqld_safe --user=mysql關(guān)閉mysql
[root@localhost mysql]# ./bin/mysqladmin -u root shutdown -p默認(rèn)密碼為空方便調(diào)用,為mysql設(shè)置一個軟鏈接[root@localhost ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
其他設(shè)置處理:
設(shè)置選項文件,將配置文件拷貝到/etc下
[root@localhost mysql]# cp support-files/my-medium.cnf /etc/mysql.cnf 設(shè)置開機自啟動[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql [root@localhost mysql]# chmod +x /etc/init.d/mysql [root@localhost mysql]# chkconfig –add mysqld[root@localhost mysql]# chkconfg mysqld on
現(xiàn)在可以通過服務(wù)來啟動和關(guān)閉Mysql服務(wù)器
[root@localhost ~]# service mysql start [root@localhost ~]# service mysql shutdown
連接服務(wù)器
[root@localhost ~]# mysql -u root -pyourpasswordWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3 to server version: 5.5.27 Source distributinoType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> ...mysql> 提示符告訴你mysql準(zhǔn)備為你輸入命令。
至此MySQL已經(jīng)正常安裝并可以使用
mysql> QUIT
相關(guān)文章
淺談mysql中多表不關(guān)聯(lián)查詢的實現(xiàn)方法
下面小編就為大家?guī)硪黄獪\談mysql中多表不關(guān)聯(lián)查詢的實現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-10-10
centos7.3 安裝mysql5.7.18的詳細(xì)教程
這篇文章主要介紹了centos7.3 安裝mysql5.7.18的詳細(xì)教程,需要的朋友可以參考下2017-06-06
MySQL命令行界面中出現(xiàn)字符錯誤提示的原因及解決方法
這篇文章主要介紹了MySQL命令行界面中出現(xiàn)字符錯誤提示的原因及解決方法,同時文中還附帶了MySQL導(dǎo)入亂碼問題的解決辦法提示,需要的朋友可以參考下2016-03-03
Mysql Binlog快速遍歷搜索記錄及binlog數(shù)據(jù)查看的方法
這篇文章主要介紹了Mysql Binlog快速遍歷搜索記錄及binlog數(shù)據(jù)查看的方法的相關(guān)資料,需要的朋友可以參考下2016-01-01
mysql數(shù)據(jù)庫中g(shù)etshell的方式總結(jié)
MySQL版本大于5.0,MySQL 5.0版本以上會創(chuàng)建日志文件,我們通過修改日志文件的全局變量,就可以GetSHELL,下面這篇文章主要給大家介紹了關(guān)于mysql數(shù)據(jù)庫中g(shù)etshell的方式,需要的朋友可以參考下2022-07-07
CenOS6.7下mysql 8.0.22 安裝配置方法圖文教程
這篇文章主要為大家詳細(xì)介紹了CenOS6.7下mysql 8.0.22 安裝配置方法圖文教程,文中安裝步驟介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-11-11

