Compiling MySql 5.6.21

#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.

cd $HOME/compile
rm -r $HOME/compile/mysql-5.6.21
tar -xzvf mysql-5.6.21.tar.gz
cd $HOME/compile/mysql-5.6.21
~/x.sh ffpg

NEW_BUILD_NAME=mysql
NEW_BUILD_VER=5.6.21
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0

#CMakeCache.txt:
CMAKE_BUILD_TYPE:STRING=RELEASE
//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING='-I/ffp/include '
//Flags used by the compiler during release builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -DNDEBUG
//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING='-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -pthread -O2 -lintl -Wall -DNDEBUG -DLINUX -I/ffp/include'
//Flags used by the compiler during release builds.
CMAKE_C_FLAGS_RELEASE:STRING=-O2 -DNDEBUG
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING= -L/ffp/lib -lintl
//Enable/Disable output of compile commands during generation.
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON
CMAKE_INSTALL_PREFIX:PATH=/ffp
//Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING= -L/ffp/lib -lintl
//Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING= -L/ffp/lib -lintl
CMAKE_VERBOSE_MAKEFILE:BOOL=ON
ENABLE_DEBUG_SYNC:BOOL=OFF
FEATURE_SET:STRING=large
MYSQL_DATADIR:PATH=/ffp/opt/srv/mysql/datadir
SYSCONFDIR:PATH=/ffp/etc
TMPDIR:PATH=/ffp/opt/srv/mysql/tmp
WITHOUT_PARTITION_STORAGE_ENGINE:BOOL=ON
WITH_DEBUG:BOOL=OFF
#WITH_SSL=/ffp
HAVE_FINITE:INTERNAL=TRUE
HAVE_FINITE_IN_MATH_H:INTERNAL=1
HAVE_LLVM_LIBCPP:INTERNAL=1
 
#all params with help text
#cmake . -LAH > cmake.help.txt
#interactive display
ccmake . -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_FLAGS="$BUILD_FLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$BUILD_FLAGS" -DCMAKE_C_FLAGS="$BUILD_FLAGS" -DCMAKE_C_FLAGS_RELEASE="$BUILD_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="-L/ffp/lib -lintl" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/ffp -DCMAKE_MODULE_LINKER_FLAGS="-L/ffp/lib -lintl" -DCMAKE_SHARED_LINKER_FLAGS="-L/ffp/lib -lintl" -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_DEBUG_SYNC=OFF -DFEATURE_SET=large -DMYSQL_DATADIR=/ffp/opt/srv/mysql/data -DSYSCONFDIR=/ffp/etc -DTMPDIR=/ffp/opt/srv/mysql/tmp -DWITH_DEBUG=0 -DHAVE_FINITE=TRUE -DHAVE_FINITE_IN_MATH_H=1
ccmake . -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/ffp -DFEATURE_SET=large
#Attention, after any CMakeCache.txt modification run again configure (press c) from ccmake gui.
#After running configure verify that HAVE_FINITE:INTERNAL=TRUE, HAVE_FINITE_IN_MATH_H:INTERNAL=1 and HAVE_LLVM_LIBCPP:INTERNAL=1.
#Then run generate (press g).

nohup /ffp/bin/make -C ~/compile/mysql-5.6.21 &
 
#MAKEPKG:
rm -r $HOME/temp/mysql-5.6.21
make install DESTDIR=$HOME/temp/mysql-5.6.21
cd $HOME/temp/mysql-5.6.21
find . -type f \( -exec sed -i s/"\/usr\/bin\/perl"/"\/ffp\/bin\/perl"/ {} \; , -exec sed -i s/"\/usr\/bin\/python"/"\/ffp\/bin\/python"/ {} \; , -exec sed -i s/"\/usr\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \; , -exec sed -i s/"\/usr\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \; , -exec sed -i s/"\/usr\/bin\/env"/"\/ffp\/bin\/env"/ {} \; , -exec sed -i s/"\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \; , -exec sed -i s/"\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \; , -exec sed -i s/"\/bin\/env"/"\/ffp\/bin\/env"/ {} \; , -exec sed -i s/"\/ffp\/ffp\/"/"\/ffp\/"/ {} \; \)
ls -l /tmp/mysql-*
ls -l ~/ffp_0.7_armv5/packages/mysql-*
makepkg mysql 5.6.21 0
 
#INSTALL & CONFIGURE
funpkg -i /$HOME/ffp_0.7_armv5/packages/mysql-5.6.21-arm-1.txz
#sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES  -> specific to mysql 5.6.x
sed -i s/"#sql_mode"/"sql_mode"/ /ffp/etc/my.cnf

#CREATE SYSTEM DB (first step and mandatory before using mysql)
export SRVPATH=/ffp/opt/srv
mkdir -p $SRVPATH/mysql/innodb/
mkdir -p $SRVPATH/mysql/innodblogdir/
mkdir -p $SRVPATH/mysql/binlog/
mkdir -p $SRVPATH/mysql/log/
mkdir -p $SRVPATH/mysql/tmp/
mkdir -p $SRVPATH/mysql/data
chmod -R 777 $SRVPATH
cd /ffp
scripts/mysql_install_db --user=root --datadir=/ffp/opt/srv/mysql/data
cd ~ && /ffp/start/mysqld.sh start
mysql -p -> the default password is nothing
UPDATE mysql.user SET Password = PASSWORD('xxx') WHERE User = 'root';
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'xxx' WITH GRANT OPTION;
FLUSH PRIVILEGES;
#mysqladmin -u root password "xxx"

#RESTORE BDs
cp /i-data/md0/seagate-ext4/ProjectsNew/nsa310-config/trunk/mysql-db-design/*.sql.gz $HOME/temp/mysql-restore
cd $HOME/temp/mysql-restore
gunzip exifweb.sql.gz
gunzip wordpress.sql.gz
gunzip owncloud702.sql.gz
gunzip ghost.sql.gz
gunzip pydio.sql.gz
ls -l *.sql
 
mysql -p
CREATE DATABASE exifweb CHARACTER SET utf8;
CREATE DATABASE wordpress CHARACTER SET utf8;
CREATE DATABASE owncloud702 CHARACTER SET utf8;
CREATE DATABASE ghost CHARACTER SET utf8;
CREATE DATABASE pydio CHARACTER SET utf8;
GRANT ALL ON exifweb.* TO 'exifweb'@'%' IDENTIFIED BY 'exifweb' WITH GRANT OPTION;
GRANT ALL ON wordpress.* TO 'wordpress'@'%' IDENTIFIED BY 'wordpress' WITH GRANT OPTION;
GRANT ALL ON owncloud702.* TO 'owncloud702'@'%' IDENTIFIED BY 'owncloud702' WITH GRANT OPTION;
GRANT ALL ON ghost.* TO 'ghost'@'%' IDENTIFIED BY 'ghost' WITH GRANT OPTION;
GRANT ALL ON pydio.* TO 'pydio'@'%' IDENTIFIED BY 'pydio' WITH GRANT OPTION;
FLUSH PRIVILEGES;
 
mysql -u root -p exifweb < exifweb.sql
mysql -u root -p wordpress < wordpress.sql
mysql -u root -p owncloud702 < owncloud702.sql
mysql -u root -p ghost < ghost.sql
mysql -u root -p pydio < pydio.sql
chmod -R 777 $SRVPATH

#UPGRADE DB schema
#If you use InnoDB, consider setting innodb_fast_shutdown to 0 before shutting down and upgrading your server.
/ffp/start/mysqld.sh stop
sed -i s/"innodb_fast_shutdown\s*=\s*1"/"innodb_fast_shutdown = 0"/ /ffp/etc/my.cnf
grep innodb_fast_shutdown /ffp/etc/my.cnf
/ffp/start/mysqld.sh start
/ffp/start/mysqld.sh stop
/ffp/start/mysqld.sh start
mysql_upgrade -u root -p --socket=/ffp/var/run/mysql/mysql.sock -v
/ffp/start/mysqld.sh stop
sed -i s/"innodb_fast_shutdown\s*=\s*0"/"innodb_fast_shutdown = 1"/ /ffp/etc/my.cnf
grep innodb_fast_shutdown /ffp/etc/my.cnf
/ffp/start/mysqld.sh start

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.