[4] 编译安装MySQL-5.5.28

mysql从5.5版本开始,不再使用./configure编译,而是使用cmake编译器,具体的cmake编译参数可以参考mysql官网文档:
# yum -y install gcc gcc-c++ make cmake autoconf automake
# yum -y install  bison  zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
# mkdir -p /data/mysql/
# mkdir -p /usr/software/
# cd /usr/software
# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz
# tar zxvf mysql-5.5.28.tar.gz
# cd mysql-5.5.28
# 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
# groupadd mysql       
# useradd mysql -g mysql -s /sbin/nologin
# cd /usr/local/mysql
# chown mysql.mysql -R .                              
# chown mysql.mysql -R /data/mysql
# cp support-files/my-medium.cnf /etc/my.cnf  
# chmod 755 scripts/mysql_install_db        
# scripts/mysql_install_db  --user=mysql  --basedir=/usr/local/mysql --datadir=/data/mysql/ --no-defaults
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod 755 /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld start
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT 
:wq
# service iptables restart
# /usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'
# /usr/local/mysql/bin/mysql -u root -p                                     
mysql> use mysql;
mysql> delete from user where password='';
mysql> flush privileges;
mysql> grant all privileges on *.* to youruser@'%' identified by "yourpassword";
mysql> flush privileges;
mysql> select User,Password,Host from user;
mysql> exit;
至此,mysql安装已经全部结束。

posted on 2012-10-28 16:11  lwysoft  阅读(408)  评论(0编辑  收藏  举报

导航