CentOS 7.4 Custom Single-instance binary installation mysql5.6.39

Source: Internet
Author: User
Tags chmod

系统平台:CentOS release 7.4 (Final) 内核 3.10.0-693.el7.x86_641. Go to the official website to download the binary package

https://dev.mysql.com/downloads/mysql/

2. Create accounts and groups to start MySQL
#getent group mysql > /dev/null || groupadd mysql#getent passwd mysql > /dev/null || useradd -g mysql -r -s /sbin/nologin mysql
3. Unpack the package to/usr/local
#tar xvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
4. Create a soft link MySQL point to the extracted directory
#cd /usr/local/#ln -sv mysql-5.6.39-linux-glibc2.12-x86_64/ mysql
5. Modify the MySQL folder owner and owning group
#chown -R mysql.mysql mysql/
6. Add path to environment variable
#echo ‘PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile.d/mysql.sh检查文件#cat /etc/profile.d/mysql.sh加载环境变量文件 并检查#source /etc/profile.d/mysql.sh#echo $PATH
7. Create a database to hold folders and related files and modify permissions
# mkdir -pv /data/mysqldb/3306/{logs,bin-logs,run,data}# touch /data/mysqldb/3306/run/mysqld.pid# touch /data/mysqldb/3306/logs/mysql-error.log# chown -R mysql.mysql /data/mysqldb/ -R# chmod -R 770 /data/mysqldb/# chown -R mysql.mysql /data/mysqldb/# chmod -R 770 /data/mysqldb文件没有创建的话,启动Mysql时将会报错
8. Modify the configuration file
#vim /etc/my.cnf[client]port = 3306socket = /tmp/mysql.sockdefault-character-set=utf8[mysqld]user = mysqlport = 3306basedir=/usr/local/mysqldatadir = /data/mysqldb/3306/datasocket = /tmp/mysql.socklog-bin = /data/mysqldb/3306/bin-logs/mysql-binbinlog_format=mixedsymbolic-links=0innodb_file_per_table = 1skip_name_resolve = 1slow_query_log = 1long_query_time = 2pid-file = /data/mysqldb/3306/run/mysqld.pidlog-error = /data/mysqldb/3306/logs/mysql-error.logcharacter-set-server=utf8default-storage-engine=INNODB[mysqld_safe]# include all files from the config directory#!includedir /etc/my.cnf.d
9. Initializing the database
# cd /usr/local/mysql# bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysqldb/3306/data
10. Copy start service script to/etc/init.d directory (small Pits)
使用二进制安装包里面的support-files/mysql.server这个启动脚本死活不能启动,报以下错误Starting MySQL. ERROR! The server quit without updating PID file (/data/mysqldb/3306/run/mysqld.pid).无奈之下,去mysql官网下载一个mysql的源码包,使用里面的mysql.server就没问题。呵呵。#cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
11. Add Boot Boot
# chkconfig --add mysqld# chkconfig mysqld on#chkconfig --list mysqldmysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
12. Start the MySQL service
#service mysqld startStarting MySQL. SUCCESS!
13. Check the Confirmation

Check if Port 3306 is turned on

#ss -ntl | grep 3306LISTEN     0      50                        *:3306                     *:*

Confirm version

# mysql -Vmysql  Ver 14.14 Distrib 5.6.39, for linux-glibc2.12 (x86_64) using  EditLine wrapper
14. Make the Security Configuration
#/usr/local/mysql/bin/mysql_secure_installation按提示操作即可
15. Client Connection
#mysql -uroot -pEnter password: Welcome to the MySQL monitor.  

CentOS 7.4 Custom Single-instance binary installation mysql5.6.39

Related Article

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.