程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> centos 5.9安裝mysql 5.5.31

centos 5.9安裝mysql 5.5.31

編輯:MySQL綜合教程

centos 5.9安裝mysql 5.5.31   在linux下安裝安裝mysql,會出現各種各樣的依賴關系,在centos下安裝mysql出現各種依賴關系 [root@localhost]# tar xzvf cmake-2.8.4.tar.gz  [root@localhost src]# cd cmake-2.8.4  [root@localhost cmake-2.8.4]# ./configure   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.4]# ./configure     C compiler on this system is: cc   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++編譯器。   [root@localhost ~]# yum install gcc-c++   重復上面的操作 [root@localhost cmake-2.8.4]# ./configue  [root@localhost cmake-2.8.4]# make  [root@localhost cmake-2.8.4]# make install   開始正式安裝Mysql   添加mysql用戶和用戶組 [root@localhost ~]# groupadd mysql  [root@localhost ~]# useradd -r -g mysql mysql 下載mysql的源碼包mysql-5.5.31.tar.gz   [root@localhost ~]#  tar xzvf mysql-5.5.31.tar.gz [root@localhost ~]# cd mysql-5.5.31    cmake運行   [root@localhost mysql-5.5.31]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci   -- Running cmake version 2.8.10.2 -- MySQL 5.5.31 -- Packaging as: mysql-5.5.31-Linux-x86_64 -- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)  CMake Error at cmake/readline.cmake:83 (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:127 (FIND_CURSES)   cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)   CMakeLists.txt:269 (MYSQL_CHECK_READLINE)   -- Configuring incomplete, errors occurred!     缺少Curses包,解決辦法:remove CMakeCache.txt  and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on  Redhat and derivates it is ncurses-devel.   在CentOS下需要安裝ncurses-devel   [root@localhost mysql-5.5.31]# yum install ncurses-devel   安裝完畢,重新cmake運行   [root@localhost mysql-5.5.31]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci .................................................................... -- Performing Test HAVE_PEERCRED - Success Warning: Bison executable not found in PATH -- Configuring done -- Generating done -- Build files have been written to: /root/mysql-5.5.31   有一個警告,缺少Bison就安裝一下   [root@localhost mysql-5.5.31]# yum install bison  刪除CMakeCache.txt,重新cmake。接下來開始編譯安裝,時間有點稍長,可以干點別的看看財經新聞  [root@localhost mysql-5.5.31]# make && make install   修改目錄權限 [root@localhost ~]# cd /usr/local/mysql [root@localhost mysql]# chown -R root:mysql . [root@localhost mysql]# chown -R mysql:mysql data    創建系統數據庫的表 [root@localhost scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data   cp配置文件  cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf    啟動mysql   /usr/local/mysql/bin/mysqld_safe  --user=mysql  &    修改環境變量 [root@localhost ~]# vi .bash_profile    # .bash_profile   # Get the aliases and functions if [ -f ~/.bashrc ]; then         . ~/.bashrc fi   # User specific environment and startup programs   PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/   export PATH unset USERNAME   如上面類似添加mysql路徑   總結 centos 下安裝很方便,因為yum已經給安裝上了,缺依賴的時候會自動下載安裝。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved