postfix安装(一)---mysql

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

你可能感兴趣的:(postfix安装(一)---mysql)