在ubuntu-12.04.3-server-i386下编译安装MySQL5.6过程大致如下:
cd ~
sudo su -
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz &
apt-get install -y bzr bison libncurses5-dev gcc g++ cmake make
wait && fg
tar xf mysql-5.6.14.tar.gz
groupadd mysql
useradd -g mysql mysql
cd mysql-5.6.14/
#以下两种方式任选其一
sh BUILD/autorun.sh
./configure --prefix=/usr/local/mysql/ --localstatedir=/data/mysqldata/data --enable-assembler --without-isam --with-unix-socket-path=/data/mysqldata/data --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-plugins=partition,innobase --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=utf8,gbk --with-big-tables --without-debug
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1-DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1-DEXTRA_CHARSETS=utf8,gbk -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci-DWITH_PARTITION_STORAGE_ENGINE=1
make && make install
chown -R mysql:mysql /usr/local/mysql/
cd /usr/local/mysql/
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
./bin/mysqld_safe &
#server mysql start
echo "export PATH=\$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
1.若make出现类似错误:
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".
CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
表明make未安装,执行:sudo apt-get install -y make
参见: Mysql 错误以及解决办法
2.如果make到63%左右出现错误:
make[2]: *** [storage/perfschema/unittest/pfs_connect_attr-t] Error 1
make[1]: *** [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2
则:cmake去掉-DWITH_PARTITION_STORAGE_ENGINE=1参数重新编译
参见: 通用MYSQL5.5和5.6源码包安装
3.MySQL启动报错:
[ERROR] InnoDB: The system tablespace must be writable!
[ERROR] Plugin 'InnoDB' init function returned error.
则:rm -rf /usr/local/mysql/data/ib_logfile*
编译参数及安装过程: Linux源码安装mysql 5.6.12 (cmake编译)
4.其他错误: Ubuntu 12 下的Mysql 5.5的 cmake 源码编译安装
5.编译错误:configure: error: No curses/termcap library found
查找文件系统:find / -name libncursesw*
如果找到则重新编译并加上以下参数:
--with-named-curses-libs=/lib/i386-linux-gnu/libncursesw.so.5.9
或者安装libncurses5-dev包:
sudo apt-cache search libncurses5 && sudo apt-get install -y libncurses5-dev
参考:http://younglab.blog.51cto.com/416652/136495
http://www.blogjava.net/wady/articles/294097.html
6.make出现错误:collect2: ld returned 1 exit status
尝试如下解决方案:
sudo apt-get install -f
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -f build-essential libncurses5-dev libncurses5
参考:What can't I install ncurses-dev in Ubuntu 12.10?、
Ubuntu 12.04 下安装ncurses-devel、mysql安装
--转自