1. 程式人生 > >install mysql from source and troubleshooting example

install mysql from source and troubleshooting example

ase The eat c++ save unzip plan use last

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