MySQL and mariadb download themselves to find their corresponding version:
https://dev.mysql.com/downloads/mysql/
Because after 5.5 has been compiled with CMake, so the system does not have, the next source of the load, how to test the system has not installed, in the command line input #cma in the Press TAB to see if there is cmake have the system has been installed, it is not installed. If you don't have a word, go to the next: https://cmake.org/download/
Plus boost to install cmake,boost:https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.gz/download.
Boost installation process:
Tar XF boost_1_59_0.tar.gz
CD Boost_1_59_0
./bootstrap.sh If prompted, install the dependent library Yum install gcc if the Error:no command provided is not present, the default command ' g++ ' no T found
"Question,
When the error is found, first verify in the system that the corresponding package is missing:
Rpm-qa | grep "g++"
After you confirm that the system is not installed, query the packages that can install the corresponding features:
Yum whatprovides "*/g++"
On the packaging to be given,
Yum Install gcc-c++-4.8.5-11.el7.x86_64
Yum install ncurses-devel-y install MySQL installation environment, maybe your machine is not installed, take a closer look, direct yum loaded just fine.
Then install boost
./b2
End
CMake installation process:
Tar XF cmake-3.8.0-rc3.tar.gz
CD CMAKE-3.8.0-RC3
./configure
Gmake && gmake Install
Unzip: Tar XF tar xf mariadb-5.5.46.tar.gz
CD Tar XF mariadb-5.5.46
CMake. -LH View the options that can be configured, the CMakeCache.txt file is generated
CMake. -dcmake_install_prefix=/usr/local/mysql
-dmysql_datadir=/data
-dsysconfdir=/etc
-dwithout_tokudb=1
-dwith_innobase_storage_engine=1
-dwith_archive_stprage_engine=1
-dwith_blackhole_storage_engine=1
-dwiyh_readline=1-dwiyh_ssl=system
-dvith_zlib=system
-dwith_lobwrap=0
-dmysql_unix_addr=/tmp/mysql.sock
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
Here is a description:-dcmake_install_prefix is the location of the specified installation, here is/usr/local/mysql,-dmysql_datadir is the specified MySQL data directory, here is/data, The installation directory and data directory can be customized settings,-dsysconfdir is the specified configuration file is located in the directory, usually/etc, the specific configuration file is/etc/my.cnf,-dwithout_tokudb=1 This parameter is generally set up, Not install the TOKUDB engine, Tokudb is an open-source storage engine in MySQL, can manage a lot of data and have some new features, these are not InnoDB, this is not installed, because the general computer default is not Percona server, And load Tokudb also rely on jemalloc memory optimization, general development is not tokudb, so temporarily shielded, otherwise in the system can not find the dependency will appear: CMake error at Storage/tokudb/perconaft/cmake_ modules/tokusetupcompiler.cmake:179 (message) such errors, and then those parameters are optional, can be added or not, the final coding recommendations set, so the compilation instructions can also be simplified as follows:
Note: If there is an error in the execution, you can execute: Rm-f CMakeCache.txt Delete the compilation cache, let the instruction re-execute, or read this file each time, the command is correct is error
CMake is not a problem, it can be compiled and installed:
Make && make install time is a bit long, wait patiently
The next step is the preparation process:
Let's start by creating a MySQL user and MySQL user group, why create it? Because you need to start the service when the MySQL user to start, other users do not, you have to ask me why, then I do not know, please ask Michael Widenius
#groupadd-R MySQL
#useradd-R-G MySQL MySQL
To change your installation directory and data directory to the main group
Chown-r Mysql.mysql/usr/local/mysql
Chown-r Mysql.mysql/data
If you don't change it, then your service will never come up.
Next, put the configuration files and boot files in the/etc directory
#cp/usr/local/mysql/support-files/my-huge.cnf/etc/my.cnf
#cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
Modify the configuration file to add my data directory
Vim/etc/my.cnf
[Mysqld]
DataDir =/data
Add PATH environment variable
vim/etc/profile.d/mysql.sh
Export path= $PATH:/usr/local/mysql/bin
source/etc/profile.d/mysql.sh Read, the current shell is in effect
The following is the initialization of the database:
Initialization
#/usr/local/mysql/mysqld--initialize--user=mysql--mysql5.7 version initialization
#/usr/local/mysql/bin/mysql_install_db--user=mysql--5.6 to 5.7 version
#/usr/local/mysql/scripts/mysql_install_db--user=mysql--datadir=/data --5.5 version
Finally, the database is started:
Service mysqld Start
Set boot up:
Chkconfig mysqld on
You can then connect to the database:
Mysql
mysql> SET PASSWORD for [email protected] ' localhost ' =password (' MySQL '); Change the password, different versions of the changes are a little different, you can check the Internet.
The last is a small problem solving method:
If you do not give the Data directory permission, the following problem occurs:
Location of Chown-r Mysql:mysql DataDir
* * Remember to turn off the previous startup items, otherwise you will occupy the PID file, you will find that you can not start the process
And there's your Server-id, not set.
Killall mysqld
1. Starting MySQL. error! The server quit without updating PID file (/var/mysql/data/localhost.localdomain.pid).
Like a socket file is also the problem:
2. ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
3, may be the second time to install MySQL on the machine, there is residual data affecting the start of the service
Workaround: Go to MySQL data directory to see if there is mysql-bin.index, quickly delete it.
This article is from the "10958002" blog, please be sure to keep this source http://10968002.blog.51cto.com/10958002/1914134
MySQL and MARIADB installation process detailed