Standard installation of MySQL binary files

Source: Internet
Author: User

Standard installation of MySQL binary files

Demo Environment

Operating System: CentOS 6.7 (64-bit)

Binary Package: mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

MySQL: http://dev.mysql.com/downloads/

1. Download MySQL

# Mkdir/root/mysql

# Cd/root/mysql

# Wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

2. Decompress

# Cd/opt/
# Mkdir mysql
# Cd mysql
# Tar zxvf/root/mysql/mysql-5.6.30 ....
# Ln-s/opt/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/usr/local/mysql
# Cd/usr/local/mysql

3. Create a user

# Groupadd mysql
# Useradd-g mysql-M-s/sbin/nologin mysql

4. Environment Variables

# Vim/etc/profile
PATH = $ PATH:/usr/local/mysql
# Source/etc/profile

5. Create a required directory
/Data/mysql/mysql3376/
Data Directory
Tmp temporary file
Logs binary log directory
# Mkdir-p/data/mysql/mysql3376/{data, tmp, logs}


6. Permissions
# Chown-R mysql: mysql/data/mysql/mysql3376/
# Chown-R mysql: mysql/opt/mysql
# Chown-R mysql: mysql/usr/local/mysql

7. Create a configuration file

[Client]
Port = 3376
Socket =/tmp/mysql3376.sock

# The MySQL server
[Mysqld]
# Basic
Port = 3376
User = mysql
Basedir =/usr/local/mysql
Datadir =/data/mysql/mysql3376/data
Tmpdir =/data/mysql/mysql3376/tmp
Socket =/tmp/mysql3376.sock

Log-bin =/data/mysql/mysql3376/logs/mysql-bin
Log-error = error. log
Slow-query-log-file = slow. log
Skip-external-locking
Skip-name-resolve
Log-slave-updates

8. Initialization

# Cd/usr/local/mysql
#./Scripts/mysql_install_db -- defaults-file =/etc/my. cnf

See OK twice

9. Start and close

Start:
#/Usr/local/mysql/bin/mysqld_safe -- defaults-file =/etc/my. cnf &

Or

#/Usr/local/mysql/bin/mysqld -- defaults-file =/etc/my. cnf &

Close:
#/Usr/local/mysql/bin/mysqladmin-S/tmp/mysql3376.sock shutdown


10. Security reinforcement

# Delete from mysql. user where user! = 'Root' or host! = 'Localhost ';
# Truncate table mysql. db;
# Drop database test;
# Flush privileges;

How can I confirm that mysql is started?

A. Check whether the process exists.
# Ps axu | grep mysqld
B. Check whether the listener is correct.
# Ss-lnpt | grep mysqld

C. Check whether the error log is abnormal.

This article permanently updates the link address:

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.