這幾天在centos下裝mysql,這裡記錄一下安裝的過程,方便以後查閱
mysql5.5.37安裝需要cmake,5.6版本開始都需要cmake來編譯,5.5以後的版本應該也要裝這個。
安裝cmake
[root@local ~]# wget
[root@local ~]# tar xvf cmake-2.8.12.2.tar.gz
[root@local ~]# cd cmake-2.8.12.2
[root@local cmake-2.8.12.2]#./bootstrap
[root@local cmake-2.8.12.2]# make
[root@local cmake-2.8.12.2]# make install
安裝mysql
[root@local ~]# wget
[root@local ~]# tar xvf mysql-5.5.37.tar.gz
[root@local ~]# cd mysql-5.5.37
[root@local mysql-5.5.37]# cmake ./
可能還會報這個錯,沒有就跳過
cmake error at cmake/readline.cmake:83(message):
remove cmakecache.txt and rerun cmake.on debian/ubuntu, package name islibncurses5-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:355 (mysql_check_readline
-- configuring incomplete, errors occurred!
see also "/root/my/mysql-5.5.37/cmakefiles/cmakeoutput.log".
see also"/root/my/mysql-5.5.37/cmakefiles/cmakeerror.log".
說明centos系統沒有ncurses-devel
[root@local ~]# wget
[root@local ~]# cd ncurses-5.9
[root@local ncurses-5.9]#./configure
[root@local ncurses-5.9]# make
[root@local ncurses-5.9]# make install
再刪除剛才編譯生成的 cmakecache.txt 檔案,否則無法進行下一步
[root@local mysql-5.5.37]# rm -f cmakecache.txt
繼續編譯mysql
[root@local ~]# cmake ./
[root@local ~]# make
[root@local ~]# make install
這樣,mysql預設將成功安裝到/usr/local/mysql
建立mysql使用者組
[root@local ~]# groupadd mysql
[root@local ~]# useradd –r –g mysql mysql
[root@local ~]# chown –r mysql.mysql /usr/local/mysql
啟動mysql
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
這裡可能會發生錯誤,沒有就跳過:
fatal error: could not find./bin/my_print_defaults
if you compiled from source, you need torun 'make install' to
copy the software into the correct locationready for operation.
if you are using a binary release, you musteither be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
解決方法:
[root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
再啟動mysql
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
註冊mysql服務,開機自動啟動
1.設定mysql配置檔案到/etc目錄
[root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
2.設定mysql開機自啟
[root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@local ~]# chmod +x /etc/init.d/mysql
[root@local ~]# /sbin/chkconfig --add mysql
3.啟動mysql服務
[root@local ~]# service mysql start
測試mysql是否安裝成功
[root@local ~]# /usr/local/mysql/bin/mysql -u root -p
enter password:
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 1
server version: 5.5.37 source distribution
oracle is a registered trademark of oraclecorporation and/or its
affiliates. other names may be trademarksof their respective
owners.
type 'help;' or '\h' for help. type '\c' toclear the current input statement.
mysql> show databases;
+--------------------+
| database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.03 sec)
參考:
Centos 5 5 編譯安裝Mysql5 5
環境 root linux lsb release a lsb version core 3.1 ia32 core 3.1 noarch graphics 3.1 ia32 graphics 3.1 noarch distributor id centos description centos r...
CentOS5 5系統安裝
最近一段時間在折騰linux,今天搞了一天終於搭建成功,其中遇到不少的問題,現在記錄下來方便查詢。先從裝系統開始 0 首先要設定計算機的bios啟動順序為光碟機啟動,儲存設定後將安裝光碟放入光碟機,重新啟動計算機。1 出現centos安裝介面 2 選擇skip跳過不測試光碟 3 選擇next下一步 ...
centos5 5 安裝中文支援
1,安裝中文支援包。yum install fonts chinese yum install fonts iso8859 2 lang zh cn.utf 8 sysfont lat0 sun16 注 若是圖形介面,可直接通過language來設定 3,安裝中文輸入法 yum install sc...