Rootop 服务器运维与web架构

linux安装mysql5.5.29

| 暂无评论

话说主从复制老出问题,怀疑是版本问题,想换成最新版本,下载,解压,找configure文件,没找到?正儿八经的,mysql5.5以后开始采用cmake方式安装。大有不同了。

参考官网文档:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

先安装gcc gcc-c++ cmake bison ncurses-devel,下载mysql。

[root@s2 ~]#wget -c http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
[root@s2 ~]#wget -c http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
[root@s2 ~]#wget -c http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.29.tar.gz

话说从国外下很慢,先用迅雷下载,再传到服务器。

[root@s2 ~]#yum install -y ncurses-devel

安装cmake
[root@s2 cmake-2.8.10.2]# ./configure
[root@s2 cmake-2.8.10.2]# gmake
[root@s2 cmake-2.8.10.2]# make install

安装bison
[root@s2 bison-2.5]# ./configure
[root@s2 bison-2.5]# make
[root@s2 bison-2.5]# make install

安装mysql:
[root@s2 ~]#useradd -s /sbin/nologin networkquestions

[root@s2 mysql-5.5.29]#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \              //编译支持所有字符
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_USER=networkquestions \
-DMYSQL_TCP_PORT=3306

[root@s2 mysql-5.5.29]#make

[root@s2 mysql-5.5.29]#make install

安装的时候比较人性化,带百分比。

修改属主
[root@s2 local]# chown -R networkquestions:networkquestions /usr/local/mysql

拷贝配置文件
[root@s2 mysql]# cp /usr/local/mysql/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
提供了更多的参考配置,我这里用innodb引擎,内存已经大于4G,采用了my-innodb-heavy-4G.cnf作为参考。

初始化


#./mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=networkquestions

Installing MySQL system tables…
OK
Filling help tables…
OK

[root@s2 support-files]# cp mysql.server /etc/init.d/mysqld

[root@s2 support-files]#chmod 755 /etc/init.d/mysqld

到此可以完成,剩余其它配置慢慢调整。

附:
编译的一个报错:
Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found.  Please install appropriate package,
这就是因为没有安装ncurses-devel。
资料说需要加软链接,这里没执行。看看会不会出现问题。
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/1530.html

作者:Venus

服务器运维与性能优化

发表回复