日期:2014-05-16  浏览次数:20957 次

mysql5.5.28.tar.gz编译安装操作笔记



1、yum安装依赖包
yum install wget gcc gcc-c++ make cmake ncurses-devel libtool zilib-devel -y


2、创建mysql用户
useradd -s /sbin/nologin -M mysql


3、编译安装mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306


make && make install


4、修改mysql配置文件
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld


5、初始化mysql
bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/ 


6、启动服务
/etc/init.d/mysqld start


7、配置mysql用户
/usr/local/mysql/bin/mysqladmin -u root password 123
/usr/local/mysql/bin/mysql -u root -p