postfix安裝(一)---mysql
系統環境:CentOS 6.0
安裝mysql 5.1.56
下載鏈接:http://dev.mysql.com/downloads/mysql/檢查一下是否存在mysql用戶
]# id mysql
id: mysql: No such user
如果沒有的話添加mysql用戶並屬組mysql
]# groupadd mysql
]# useradd mysql -g mysql
解壓tar包
]# tar zxf mysql-5.1.56.tar.gz
]# cd mysql-5.1.56
configure時遇到報錯
]# ./configure --prefix=/usr/local/mysql --with-charset=gbk
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/softwares/mysql-5.1.56':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
報錯原因是沒有編譯器gcc cc,用yum安裝後,並檢測是否安裝成功
]# yum install gcc cc -y
]# cc
cc: no input files
]# whereis cc
cc: /usr/bin/cc
]# whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
重新編譯,又出現如下報錯:
checking for termcap functions library... configure: error: No curses/termcap library found
原因:
缺少ncurses(是一個能提供基於文本終端窗口功能的動態庫)安裝包
]# rpm -qa |grep ncurses
ncurses-base-5.7-3.20090208.el6.x86_64
ncurses-libs-5.7-3.20090208.el6.x86_64
ncurses-5.7-3.20090208.el6.x86_64
安裝ncurses開發包
]# yum install ncurses-devel -y
configure mysql成功的話應該會有下列提示:
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
編譯
]# make
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] Error 127
make[1]: Leaving directory `/home/softwares/mysql-5.1.56/mysys'
make: *** [all-recursive] Error 1
../include/my_global.h:1108: error: redeclaration of C++ built-in type 'bool'
make[1]: *** [my_new.o] Error 1
編譯時,出現g++報錯,安裝gcc-g++
]# yum install gcc-c++ -y
安裝完缺少的包以後,再重新解壓tar包重新編譯
]# make install
生成mysql配置文件
]# pwd
/home/softwares/mysql-5.1.56/support-files
]# cp -r my-medium.cnf /etc/my.cnf
]# cp mysql.server /etc/init.d/mysqld
設置mysqld程序開機自動啓動
]# chmod 700 !$
chmod 700 /etc/init.d/mysqld
]# chkconfig --list |grep mysql
]# chkconfig --add mysqld
]# chkconfig --list |grep mysql
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
初始化數據庫生成var目錄
]# /usr/local/mysql/bin/mysql_install_db --user=mysql
修改/usr/local/mysql下文件屬主和屬組
除了var目錄的屬主和屬組都爲mysql外,其餘的只需要將屬組設爲mysql即可
mysql]# chown -R root:mysql .
mysql]# chown -R mysql var
啓動mysql
]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
service mysqld restart
ps aux |grep mysqld
netstat -anpt |grep 3306