Binary package installation MySQL

Source: Internet
Author: User
Tags benchmark mysql version file permissions

1. Preface

There are three ways to install MySQL: RPM installation, binary package installation, source package installation. These 3 various ways each have the characteristic, the main characteristic refer to the following table. In real-world applications, you can optimize based on the host environment you use, choose the best configuration values, and install customizations more flexibly. Visit the MySQL website http://dev.mysql.com/downloads/download the latest stable release of the corresponding MySQL version, this article on the MySQL 5.6.26 binary version of the installation demo.

Rpm

Binary

Source

Advantages

Easy to install, suitable for beginners

Simple installation, can be installed into any path, flexibility, a server can install multiple MySQL.

The actual installed operating system can be customized according to the needs of the compilation, the most flexible, the best performance, one server can install multiple MySQL.

Disadvantages

1. You need to download the client and server side separately;

2. Installation path is not flexible, the default path can not be modified, a set of servers can only install one MySQL.

has been compiled, performance is not as good as the source code compiled, can not be flexibly customized compilation parameters.

The installation process is more complex and the compilation time is long

File layout

/usr/bin client programs and scripts

/usr/sbin MySQL Server

/var/lib/mysql Log files and databases

/usr/share/doc/packages Documentation

/usr/include/mysql Include files

/usr/lib/mysql Library file

/usr/share/mysql error messages and character set files

/usr/share/sql-bench Benchmark Program

Bin client program and Mysqlid server

Data log files and databases

Doc Documentation and Changelog

Include include file

Lib Library file

Scripts mysql_install_db script to install the system database

Share/mysql error Message File

Sql-bench Benchmark Program

Bin client programs and scripts

Include/mysql Include files

Documents in Info Info format

Lib/mysql Library file

Libexec MySQL Server

Share/mysql error Message File

Sql-bench Benchmark program and CRASH-ME test

Var Database and log files

2. Preparation before installation

Test environment for this article: CentOS release 6.4 (Linux version 2.6.32-358.el6.x86_64)

1) Set up MySQL users and groups

Create MySQL user groups and users, if not established, after installing MySQL binary package, MySQL startup will cause problems due to Linux file permissions

New MySQL user group:

[SQL]View Plain Copy
    1. [[email protected] ~]# Groupadd MySQL

New MySQL User:

[SQL]View Plain Copy
    1. [[email protected] ~]# useradd-r-g MySQL MySQL

2) New MySQL database data file directory

[SQL]View Plain Copy
    1. [Email protected] ~]# mkdir-p/data/mysqldb
    2. [Email protected] ~]# chown-r mysql:mysql/data/mysqldb
    3. [Email protected] ~]# cd/usr/Local

3. Install MySQL

1) Download MySQL binary installation package

: http://dev.mysql.com/downloads/mysql/in Select Platform: Linux-generic, Then download the bottom: mysql-5.6.26-linux-glibc2.5-x86_64..tar.gz (with 64-bit and 32-bit, select as needed)

2) Unpack the binary package

[SQL] view plain copy
  1. [Email protected] local]# TAR-XZVF mysql-5.6.26.tar.gz
  2. [[email protected] local]# mv mysql-5.6.26 MySQL
  3. [Email protected] local]# CD mysql/
  4. [[email protected] mysql]# chown-r MySQL.
  5. [[email protected] mysql]# chgrp-r MySQL.

In fact, MySQL has been installed, but also need to initialize, initialize MySQL table, test table, infomation table and so on. DataDir can be other, but it also needs to be chown modified under the creator, otherwise there may be permissions issues.

4. Configure MySQL

[SQL]View Plain Copy
    1. [Email protected] mysql]# scripts/mysql_install_db.sh --user=mysql--basedir=/usr/local/mysql--datadir=/data/ MySQLdb

[SQL]View Plain Copy
    1. [Email protected] mysql]# chown-r root.
    2. [[email protected] mysql]# chown-r mysql data
    3. [[email protected] mysql]# chgrp-r MySQL.

1) Provide SYSV service script for MySQL

[SQL]View Plain Copy
    1. [email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld

2) Modify the configuration file

[SQL]View Plain Copy
    1. [email protected] mysql]# CP my.cnf/etc/my.cnf
    2. [Email protected] mysql]# VI/ETC/MY.CNF

3) Add MySQL to the service list

[SQL]View Plain Copy
    1. [Email protected] mysql]# chkconfig --add mysqld
    2. [Email protected] mysql]# chkconfig mysqld on

4) Start the service and use the MySQL user to start the service

[SQL]View Plain Copy
    1. [Email protected] mysql]# Bin/mysqld_safe --user=mysql

5) Log in to the database

[SQL]View Plain Copy
    1. [Email protected] mysql]# bin/mysql-u root

6) set root initial password

[SQL]View Plain Copy
    1. [Email protected] mysql]# bin/mysqladmin-u root password "123456"

7) Other operations

[SQL]View Plain Copy
  1. mysql> Select user,host,password from MySQL.  User --Query MySQL user, password, etc.
  2. mysql> update MySQL. User set password = password (' 000000 ') where user = ' root ' --Change root password
  3. mysql> Drop user ' @localhost; --Delete empty users
  4. Mysql> FLUSH privileges;

Binary package installation MySQL

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.