以下命令请用root执行,刚刚测试完毕,可在centos6.1下顺利安装。(Centos最小桌面安装+开发工具)
- yum install -y ncurses-devel bison
- wget http://mysql.he.net/Downloads/MySQL-5.5/mysql-5.5.19.tar.gz
- wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
-
- groupadd mysql
- useradd mysql -g mysql -M -s /sbin/nologin
- mkdir -p /usr/local/mysql/data
- mkdir -p /usr/local/mysql/log
- chmod +w /usr/local/mysql
- tar zxvf cmake-2.8.6.tar.gz
- tar zxvf mysql-5.5.19.tar.gz
- cd cmake-2.8.6
- ./bootstrap
- gmake
- gmake install
-
- cd ../mysql-5.5.19
- cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DWITH_DEBUG=0
- make
- make install
-
- cp support-files/mysql.server /etc/init.d/mysqld
- chmod +x /etc/init.d/mysqld
- chown -R mysql:mysql /usr/local/mysql
- ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
- ln -s /usr/local/mysql/bin/mysql /sbin/mysql
- ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
- ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
- cp support-files/my-huge.cnf /etc/my.cnf -f
-
- /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
- chkconfig --add mysqld
- chkconfig --level 2345 mysqld on
- service mysqld start
- mysqladmin -u root password "yourpasswd"
- mysql -u root -p
复制代码 |