5 ways to install MySQL:
Yum
Rpm
General compilation
Binary package, without compiling
CMake
MySQL 5.5 version and above the number of machines recommended CMake number of multi-binary packages
Installation steps:
1. Install some of the most commonly used packages:
Yum-y Install openldap-servers libevent-devel libevent uuid-devel
Yum-y Install Bison bison-devel
Yum-y install gcc gdb strace gcc-c++ autoconf
Yum-y install libxml2 libxml2-devel zlib zlib-devel
Yum-y install gcc gcc-c++ OpenSSL openssl-devel ncurses ncurses-devel cmake
Yum-y Install git
Ncurses-devel (this has to be installed, MySQL relies on it)
2.mysql website download page
MySQL Community Server 5.5.55
Looking for the latest GA version?
Select Version:
5.5.55
Select Operating System:
Source code (to select this is the original package) (Linux-generic). tar.gz is a binary package)
Select OS Version:
3. Installing CMake
wget Https://github.com/Kitware/CMake/archive/master.zip
Unzip Master.zip
CD cmake-master/
./bootstrap or./configure
Gmake
Gmake Install
3. Install the database:
Wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz (This is a binary package)
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.55.tar.gz
(This is the source code package, download this)
Tar XF mysql-5.5.55.tar.gz
echo $?
CD mysql-5.5.55
Add MySQL User
Useradd mysql-s/sbin/nologin-m
Compile
CMake \
-dcmake_install_prefix=/install/mysql \
-dmysql_datadir=/install/mysql/data \
-DSYSCONFDIR=/ETC \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_partition_storage_engine=1 \
-dwith_readline=1 \
-dmysql_unix_addr=/var/lib/mysql/mysql.sock \
-dmysql_tcp_port=3306 \
-denabled_local_infile=1 \
-dwith_partition_storage_engine=1 \
-dextra_charsets=all \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci
Make && make install
To configure environment variables:
Echo ' Export path=/install/mysql/bin: $PATH ' >>/etc/profile
Tail-1/etc/profile
Source/etc/profile
Echo $PATH
Chown-r mysql.mysql/install/mysql/data/
Chmod-r 1777/tmp/
Initialization
cd/install/mysql/scripts/
./mysql_install_db--basedir=/install/mysql/--datadir=/install/mysql/data/--user=mysql
If the installation is successful, you will be prompted with the following large list of messages
Success Information: Installing MySQL system tables ... 170407 8:33:03 [Note] Ignoring--secure-file-priv value as server is running with--bootstrap. 170407 8:33:03 [Note]/install/mysql//bin/mysqld (mysqld 5.5.55) starting as Process 3037 ... OK Filling Help Tables ... 170407 8:33:04 [Note] Ignoring--secure-file-priv value as server is running with--bootstrap. 170407 8:33:04 [Note]/install/mysql//bin/mysqld (mysqld 5.5.55) starting as Process 3044 ... OK to start mysqld at boot time with to copy Support-files/mysql.server to the right place for your Syst Em REMEMBER to SET A PASSWORD for the MySQL root USER! To does, start the server, then issue the following commands:/install/mysql//bin/mysqladmin-u root password ' new -password '/install/mysql//bin/mysqladmin-u root-h localhost.localdomain password ' new-password ' Alternati Vely You can run:/install/mysql//bin/mysql_sEcure_installation which would also give you the option of removing the test databases and anonymous user CRE Ated by default. This is the strongly recommended for production servers. See the Manual for more instructions. You can start the MySQL daemon with:cd/install/mysql/; /install/mysql//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd/install/mysql Mysql-test; Perl mysql-test-run.pl problems at http://bugs.mysql.com//BIN/CP Support-files/mysql.serv Er/etc/init.d/mysqld
Boot up
/BIN/CP Support-files/mysql.server/etc/init.d/mysqld
chmod +x/etc/init.d/mysqld
Chkconfig mysqld on
Chkconfig--list
Mkdir-p/var/lib/mysql
Chown-r mysql.mysql/var/lib/mysql/
Chmod-r 1777/var/lib/mysql/
Copy the corresponding MySQL configuration file
Cp/soft/src/mysql-5.5.55/support-files/my-huge.cnf/etc/my.cnf
Start:/etc/init.d/mysqld start
Login:
Mysql
Select User,host from Mysql.user;
Remove redundant users
Delete from mysql.user where user= ';
Delete from Mysql.user where host= ' localhost.localdomain ';
Delete from Mysql.user where host= ':: 1 ';
Set Password:
/install/mysql/bin/mysqladmin-u root password ' new-password '
CentOS MySQL 5.5 Source code cmake installation