Cause:
CentOS built-in source the default installation of Mysql-server is too old, does not support the call of some new methods, need to reinstall a new version
The old version has data, do not want to uninstall, want to keep the library and the software itself
Docker is not running on the machine and the database is not suitable for Docker
It seems that the compiled installation is best for
Goal:
Compiling and installing mysql-server5.6.32
and keep mysql-server-5.1.73-7.el6.x86_64
Preparatory work:
Backing up the original configuration file
(Backup RPM Package installed Mysql-server profile)
Cp/etc/my.cnf/etc/my.cnf.bak
Download package
wget http://downloads.mysql.com/archives/get/file/mysql-5.6.32.tar.gz
TAR-ZXVF mysql-5.6.32.tar.gz
Specific steps
Switch to Mysql-server directory ready to compile the source code
CD mysql-5.6.32
Run the following CMake directive, prompting for missing Libncurses5-dev
Yum Install Libncurses5-dev
Failed because Libncurses5-dev is the package name under Debian, and CentOS should run under
Yum Install Ncurses-devel
Run the compilation again
CMake
-dcmake_install_prefix=/usr/local/mysql
-dmysql_unix_addr=/usr/local/mysql/mysql.sock
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dmysql_datadir=/home/mysqldata
-dmysql_tcp_port=3306
-denable_downloads=1
------------------------
Note: To rerun the configuration, you need to delete the CMakeCache.txt file in the directory
RM CMakeCache.txt
------------------------
Make && make install
Use the following command to see if there are MySQL users and user groups
(because I originally have RPM package installed on this machine MySQL all the steps to view or add user groups!) )
CAT/ETC/PASSWD View the list of users
Cat/etc/group viewing a list of user groups
If not, create
Groupadd MySQL
useradd-g MySQL MySQL
Modify/usr/local/mysql Permissions
Chown-r Mysql:mysql/usr/local/mysql
Modifying a configuration file
CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF
Vi/etc/my.cnf
-----MY.CNF BEGIN------
[Client]
Default-character-set=utf8
Socket =/usr/local/mysql/mysql.sock
[MySQL]
Default-character-set=utf8
[Mysqld]
# Remove Leading # and set to the amount of RAM for the most important data
# Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove Leading # to turn on a very important data integrity option:logging
# Changes to the binary log between backups.
# Log_bin
# These is commonly set, remove the # and set as required.
Basedir =/usr/local/mysql
DataDir =/home/mysqldata/
Port = 3306
# server_id = ...
Socket =/usr/local/mysql/mysql.sock
Character-set-server=utf8
# Remove Leading # To set options mainly useful for reporting servers.
# The server defaults is faster for transactions and fast selects.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
Sql_mode=no_engine_substitution,strict_trans_tables
-----MY.CNF End------
Initializing the database
cd/usr/local/mysql/
./scripts/mysql_install_db--user=mysql--datadir=/home/mysqldata
Modify file and directory permissions, or open service will error
Chown-r Mysql:root/usr/local/mysql/mysql.sock
Chown-r Mysql:root/usr/local/mysql
Test to turn on MySQL for compiled installation
/usr/local/mysql/bin/mysqld_safe
Add startup script If you are running normally
CP Support-files/mysql.server/etc/init.d/mysql
Chkconfig MySQL on
Service MySQL Start--start MySQL
--------------
Note that because I have the original RPM package installed Mysql-server,
So in order not to overwrite its startup script
CP Support-files/mysql.server/etc/init.d/mysql_tarball
Chkconfig Mysql_tarball on
Service Mysql_tarball Start--Starting MySQL
--------------
Compiling and installing mysql-server5.6.32 notes