CentOS 5.5下裝置MySQL 5.5全進程分享。本站提示廣大學習愛好者:(CentOS 5.5下裝置MySQL 5.5全進程分享)文章只能為提供參考,不一定能成為您想要的結果。以下是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體系的裝置盤中裝置,也能夠簡略地用yum裝置
[root@localhost ~]# yum install gcc
持續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體系的裝置盤中裝置,或許簡略地用yum裝置
[root@localhost ~]# yum install gcc-c++
反復下面的操作
[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 .在編譯裝置前,可以設置裝置的設置裝備擺設選項
[root@localhost mysql-5.5.27]# ./configure --help依據贊助信息選擇本身須要設置的選項,固然也能夠跳過這步,按默許設置
#開端編譯裝置,時光有點稍長...
[root@localhost mysql-5.5.27]# make && make install完成編譯裝置
進入裝置目次,將法式二進制的一切權改成root,數據目次的一切權改成mysql用戶,更新受權表
[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 初始化數據庫[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封閉mysql
[root@localhost mysql]# ./bin/mysqladmin -u root shutdown -p默許暗碼為空便利挪用,為mysql設置一個軟鏈接[root@localhost ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
其他設置處置:
設置選項文件,將設置裝備擺設文件拷貝到/etc下
[root@localhost mysql]# cp support-files/my-medium.cnf /etc/mysql.cnf 設置開機自啟動[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
如今可以經由過程辦事來啟動和封閉Mysql辦事器
[root@localhost ~]# service mysql start [root@localhost ~]# service mysql shutdown
銜接辦事器
[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預備為你輸出敕令。
至此MySQL曾經正常裝置並可使用
mysql> QUIT