码迷,mamicode.com
首页 > 数据库 > 详细

install mysql from source and troubleshooting example

时间:2018-05-20 10:42:04      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:you   span   failed   log-error   plugin   err   writing   oca   style   

I tried to install MySQL 5.7 from source file and upgrading previous MySQL version to the lastest 5.7.22.

following command record is shared as a note.

not many explanations. If having  any questions, you can make a comment and I will reply when I see it.

 

## REFERENCE
https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html#option_cmake_download_boost

## install tools
yum install make gcc-c++ cmake bison-devel ncurses-devel

## create user and dir
id mysql
mkdir /usr/local/mysql
mkdir -p /data/mydb

chown -R mysql.mysql /usr/local/mysql
chown -R mysql.mysql /data/mydb

## unzip source package
cd /home/maxwellyang/Desktop/mysql-dev/source_code
tar -zxvf mysql-5.7.22.tar.gz

## make clean
cd mysql-5.7.22
make clean

## run cmake
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ # install dir
-DMYSQL_DATADIR=/data/mydb \ # data dir
-DSYSCONFDIR=/etc \ # my.cnf dir
-DEFAULT_CHARSET=utf8mb4 \ 
-DDEFAULT_COLLATION=utf8mb4_general_ci -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDOWNLOAD_BOOST=1 \ # auto download boost library file
-DWITH_BOOST=/home/maxwellyang/Desktop/mysql-dev/source_code/boost \ # boost library save dir
-DINSTALL_LAYOUT=STANDALONE


make

make install

## problem encountered after using the compiled version
/etc/init.d/mysqld start # execute failed without writing to mysql error log
bash -x /etc/init.d/mysqld start # to see where script stopped, suspect script maybe error out at /usr/local/mysql/bin/mysqld_safe --datadir=/data/mydb --pid-file=/data/mydb/mysql-dev.pid

bash -x /usr/local/mysql/bin/mysqld_safe --datadir=/data/mydb --pid-file=/data/mydb/mysql-dev.pid # suspect script maybe error out at /usr/local/mysql/bin/mysqld  --basedir=/usr/local/mysql --datadir=/data/mydb --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql  --log-error=/data/mydb/3306.err --pid-file=/data/mydb/mysql-dev.pid --port=3306

/usr/local/mysql/bin/mysqld  --basedir=/usr/local/mysql --datadir=/data/mydb --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql  --log-error=/data/mydb/3306.err --pid-file=/data/mydb/mysql-dev.pid --port=3306 # this script error with [ERROR] COLLATION utf8mb4_general_ci is not valid for CHARACTER SET latin1

# now we see problem is related to collation and characterset.
# my previous database charset is latin1, which is the default charset when installing with tar.gz package
# but the default collation for the compiled version is utf8mb4_general_ci, which is not compatible with charset latin1
# plus I dont specify collation-server paramter in /etc/my.cnf
# so one solution is to specify collation-server parameter in /etc/my.cnf, 1 usable options is collation-server=latin1_german1_ci
# then the above /usr/local/mysql/bin/mysqld script can success
# tried the /etc/init.d/mysqld start, can work also.

 

install mysql from source and troubleshooting example

标签:you   span   failed   log-error   plugin   err   writing   oca   style   

原文地址:https://www.cnblogs.com/maxyang2008/p/9062300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!