CENTOS7 binary installation package installation mysql5.6

Source: Internet
Author: User

CENTOS7 binary installation package installation mysql5.6

First, download mysql5.6 binary installation package

http://mirrors.sohu.com/mysql/MySQL-5.6/

such as: mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz

Second, install mysql5.6 (installed in/data/mysql56)

(1), create MySQL user account

> Useradd-s/sbin/nologin-m mysql


(2), unzip the compressed package

> Tar XF mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz


(3), renaming

> MV mysql-5.6.34-linux-glibc2.5-x86_64 mysql56


(4), copy the configuration file

> cp/data/mysql56/support-files/my-default.cnf/etc/my.cnf

(* binary installation, default Config file in/etc/my.cnf)

(5), initialize the database

> Chown-r mysql.mysql/data/mysq56>/data/mysql56/scripts/mysql_install_db--user=mysql--basedir=/data/ Mysql56--datadir=/data/mysql56/data

If the following information appears

FATAL Error:please Install the following Perl modules before Executingdata::D umper
> yum-y Install autoconf

The Data:dumper module is installed when this package is installed

Third, configure and start MySQL

> cp/data/mysql56/support-files/mysql.server/etc/init.d/mysqld> chmod 755/etc/init.d/mysqld

(* Note that the default path for MySQL binary installation is/usr/local/mysql,/usr/local/mysql need to be replaced in the startup script)

> sed-i ' s#/usr/local/mysql#/data/mysql56#g '/data/mysql56/bin/mysqld_safe/etc/init.d/mysqld

Start MySQL

> Service mysqld Start


Iv. adding self-priming

> Chkconfig--add mysqld> chkconfig mysqld on> chkconfig--list mysqld


V. Configuring Environment variables

> Echo ' export path=/data/mysql56/bin: $PATH ' >>/etc/profile> source/etc/profile


Vi. Modify the MySQL password (mysql5.6 install default root password is empty)

> mysqladmin-u root password ' 123456 '


Vii. clean up useless MySQL users and libraries
Log in to MySQL

> mysql-uroot-p

Query users

> select User,host from Mysql.user;

As shown below

+------+-----------------------+| user | Host                  |+------+-----------------------+| root | 127.0.0.1             | | root |:: 1                   | |      | localhost             | | root | localhost             | |      | localhost.localdomain | | root | localhost.localdomain |+------+-----------------------+
> Drop User "root" @ ":: 1";> drop user "@" localhost ";> drop user" @ "localhost.localdomain";> drop User "root" @ "Localhost.localdomain";

Delete Useless libraries

> drop database test;



CENTOS7 binary installation package installation mysql5.6

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.