安裝的mysql資料庫是:mysql-5.6.4-m7,這個版本的資料庫要用cmake工具安裝。 CMake是一個跨平台的安裝(編譯)工具,可以用簡單的語句來描述所有平台的安裝(編譯過程)。他能夠輸出各種各樣的makefile或者project檔案,能測試編譯器所支援的C++特性,類似UNIX下的automake cmake:http://www.cmake.org/cmake/resources/software.html 1、安裝cmake[root@localhost tmp]# cd cmake-2.8.9/[root@localhost cmake-2.8.9]# ./bootstrap[root@localhost cmake-2.8.9]#make[root@localhost cmake-2.8.9]#make install 如果要更新cmake 只需進入相關目錄,執行cmake.makemake install 2、安裝mysql[root@localhost mnt]# cd mysql-5.6.4-m7/[root@localhost mnt]# cmake . 可能回出現下面問題:-- 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:136 (FIND_CURSES) cmake/readline.cmake:226 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:262 (MYSQL_CHECK_READLINE)按照上面內容提示的方法進行修改:若是redhat 安裝ncurses-devel這個包即可。 [root@localhost mysql-5.6.4-m7]# yum install ncurses-devel*[root@localhost mysql-5.6.4-m7]# rm CMakeCache.txt (注意這裡是刪除CMakeCache.txt ,有一個跟他很相似的檔案,別刪錯了!)[root@localhost mysql-5.6.4-m7]#make[root@localhost mysql-5.6.4-m7]#make install 3、安裝預設的資料庫 [mysql@localhost mysql]$ cd scripts/[mysql@localhost scripts]$ ls[mysql@localhost scripts]$ sudo ./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql 安裝完後有這麼一段提示,可以仔細看看:To start mysqld at boot time you have to copysupport-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 localhost.localdomain password 'new-password' Alternatively you can run:/usr/local/mysql//bin/mysql_secure_installation which will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers. See the manual for more instructions.You can start the MySQL daemon with:cd /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.plcd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl