Red Hat 6.5 compiled and installed MySQL 5.7.11

Source: Internet
Author: User

Install operating system considerations – Development package Four options all Select Install
Yum configuration is easy to use
Mount the local CD-ROM to the system: put the rhel6.5 installation CD into the CD-ROM drive and operate at the terminal command line
Mkdir/media/rhel #新建挂载目录
Mount/dev/cdrom/media/rhel #挂载光盘到 the/media/rhel directory
Cd/media/rhel #进入挂载目录
LS #查看挂载目录, disc mounted successfully
Configure local Yum Source
Cd/etc/yum.repos.d/#进入yum配置目录
Touch Rhel-media.repo #建立yum配置文件
VI Rhel-media.repo #编辑配置文件, add the following:
[Rhel-media]
name=red Hat Enterprise Linux 6.5
Baseurl=file:///media/rhel
Enabled=1
Gpgcheck=1
Gpgkey=file:///media/rhel/rpm-gpg-key-redhat-release
Clear Yum Cache, install software automatically using Yum install
Yum Clean all #清除yum缓存

Uninstalling the system comes with MySQL
Check to see if the system comes with MySQL, uninstall it if any, there are two kinds of yum, RPM, here to uninstall via Yum
Rpm-qa | grep mysql//view system comes with MySQL
Yum-y Remove mysql-*//uninstall MySQL this can
Rpm-e–nodeps mysql-5.1.73-3.el6_5.x86_64//uninstall MySQL

Uninstalling the system comes with boost and installs Boost_1_59_0
MySQL 5.7.11 relies on boost_1_59_0 or later to see if the system has its own boost, and if so, uninstalls it.
Rpm-qa | grep boost//View system comes with boost
Yum-y Remove boost-*//Offload boost
Rpm-e–nodeps boost-filesystem-1.41.0-11.el6_1.2.x86_64//Offload boost

Install BOOST_1_59_0, CMake compile-time plus-dwith_boost=/usr/local/boost
TAR-ZXVF boost_1_59_0.tar.gz
CD Boost_1_59_0
./bootstrap.sh
./B2 Install

Installing CMake
TAR-ZXVF cmake-3.4.1.tar.gz
./configure
Make && make install

Create user groups MySQL and user MySQL
Check if the system already has a MySQL user and if not, create
Cat/etc/group | grep MySQL//See if there is a MySQL user group
cat/etc/passwd | grep MySQL//See if a MySQL user exists
Groupadd MySQL//create user groups
Useradd-r-G MySQL MySQL//create user

Create MySQL directory and database directory, and give users MySQL permissions
Create MySQL directory and database directory
Mkdir/usr/local/mysql//Create MySQL Directory
Mkdir/usr/local/mysql/data//Create a database directory
Chown-r mysql:mysql/usr/local/mysql//give permission

compiling, installing MySQL
Compile with some parameters such as installation root, database directory, encoding, port number, default storage engine, etc.
When compiling, remember to bring-dwith_boost=/usr/local/boost.

TAR-ZXVF mysql-5.7.11.tar.gz
CD mysql-5.7.11
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-ddefault_charset=utf8-ddefault_ Collation=utf8_general_ci-dmysql_tcp_port=3306-dmysql_user=mysql-dwith_myisam_storage_engine=1-dwith_innobase_ Storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_memory_storage_engine=1 -denable_downloads=1-ddownload_boost=1-dwith_boost=/usr/local/boost
Make && make install

If a compilation error occurs, the compilation fails before recompiling to delete the file
When recompiling, you need to clear the old object file and cache information
Make clean
Rm-f CMakeCache.txt

Configure MY.CNF
MY.CNF files can be based on their own needs to choose the right configuration, there are many online, you can refer to, here is not detailed description. Remember to put the MY.CNF in/etc directory
MV MY.CNF/ETC/MY.CNF

Initializing the System data table
Starting with mysql5.7, initializing the system table no longer uses the mysql_install_db tool, but instead uses Mysqld–initialize-insecure–user=mysql, where –initialize indicates that a secure password is generated by default. –initialize-insecure means no password is generated and the password is empty
Cd/usr/local/mysql
Bin/mysqld–initialize-insecure–user=mysql–basedir=/usr/local/mysql–datadir=/usr/local/mysql/data

Add environment variables, register as system service
Add an environment variable and add parameters to PATH:/usr/local/mysql/bin:/usr/local/mysql/lib
Vim/root/.bash_profile
Path=< Span>p a t h : Home/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
Source/root/.bash_profile

Registering as a system service
CP Support-files/mysql.server/etc/init.d/mysqld
Chkconfig mysqld on
Service Mysqld Start/stop/restart/status

First Login setting password
Mysqladmin-uroot-p password 123456//Login time
SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' 123456 '); After login

View process
NETSTAT-LNTP | grep 3306
Pkill mysqld

    • Top

    • 0

    • Step

    • 0


This article from the "Struggle for the Dream" blog, declined to reprint!

Red Hat 6.5 compiled and installed MySQL 5.7.11

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.