Mysql installation (Using Generic Binaries)

Source: Internet
Author: User
Tags install perl

This time Mysql is the community 5.6.21 version, installed in the General Linux installation mode, that is, most Linux platforms can be installed in this way.

First, installation steps

1. Installation Environment

1) Centos 7.0.1406 x86_64

2, download Mysql, unzip, create a soft connection, with the official decompression path to provide some of the license.

$ wget http://cdn.mysql.com/downloads/mysql-5.6/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz$ sudo tar zxvf Mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz-c/usr/local/src/$ sudo ln-s/usr/local/src/ mysql-5.6.21-linux-glibc2.5-x86_64//usr/local/mysql

3, the installation method is divided into two kinds.

Mode 1 Refer to MySQL official instructions for installation, multi-use in MySQL learning environment, the following command source MySQL official, the original text see installing MySQL on Unix/linux using Generic Binaries

shell> Groupadd mysqlshell> useradd-r-g MySQL mysqlshell> cd/usr/localshell> tar zxvf/path/to/mysql-versio  n-os.tar.gzshell> ln-s full-path-to-mysql-version-os mysqlshell> cd mysqlshell> chown-r mysql .shell> chgrp -R MySQL .shell> scripts/mysql_install_db--user=mysqlshell> chown-r root .shell> chown-r MySQL datashell> Bin/mysqld_safe--user=mysql Next command is optionalshell> CP support-files/mysql.server/etc/init.d/ Mysql.server

Mode 2 Customize the Mysql data save path, which is used in the deployment environment.

1) Create MySQL users and user groups

$ sudo groupadd mysql$ sudo useradd-r-g MySQL mysql$ cd/usr/local/src/$ sudo chown-r mysql:mysql mysql-5.6.21-linux-gl IBC2.5-X86_64/#定义mysql用户以及组 $ ll total dosage 4drwxr-xr-x. MySQL mysql 4096 November  5 08:10 mysql-5.6.21-linux-glibc2.5-x86_64

2) Create the MySQL data file save location, if using the data disk to mount itself.

$ sudo mkdir-p/data/mysql #定义mysql数据文件保存地址

3) Initialize Mysql, problems that may arise see the article at the bottom of the problem handling method

$ sudo/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/data/mysql/# Initialize MySQL

4) Configuration my.cnf

This example is only guaranteed to work correctly, so configure the following three items.

  Basedir =/usr/local/mysql  datadir =/data/mysql  port = 3306

Establish a soft connection my.cnf to the/etc/directory

$ sudo ln-s/usr/local/mysql/my.cnf/etc/my.cnf

5) Start the Mysql service

6) Login to Mysql

$/usr/local/mysql/bin/mysqlwelcome to the MySQL monitor.  

Second, start the boot

$ sudo chkconfig--add mysqld

Third, environment variables

1) Edit Profile

$ sudo vi/etc/profile

2) Add the following information to the bottom of the profile

Export path= $PATH:/usr/local/mysql/bin

3) Immediate effect configuration file

$ source/etc/profile

Four, MySQL remote connection

Mysql> Select User (); +----------------+| User ()         |+----------------+| [Email protected] |+----------------+1 row in Set (0.01 sec) Mysql> grant all privileges on  * * to [email protected] '% ' identified by ' your password '; Query OK, 0 rows Affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)

Five, firewall open

Centos 7 default enable firewall management port

1) Check the port opening situation, if not previously installed will show no description 3306 port is not open, and the contrary yes indicates that it is open directly available to the MYSQL client remote access!

$ sudo firewall-cmd--query-port=3306/tcpno

2) temporarily open 3306 port

$ sudo firewall-cmd--add-port=3306/tcpsuccess

3) Permanently open 3306 Port

$ sudo firewall-cmd--permanent--zone=public--add-port=3306/tcpsuccess$ sudo firewall-cmd--reload #重新加载配置success [[ Email protected] ~]$ sudo firewall-cmd--zone=public--list-all #查看添加结果public (default, active)  Interfaces:eth0  sources:   services:dhcpv6-client ssh  ports:3306/tcp 22/tcp  masquerade:no  forward-ports:   Icmp-blocks:   

Vi. Collation of problems

Question 1:

$ sudo scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/data/mysql/sudo:unable to execute Scripts/mysql_install_db:no such file or directory

Solution: Solve this problem is purely coincidental, remove sudo hint Perl parser problem, reinstall under

$ sudo yum install perl$ sudo yum install perl-data-dumper.x86_64

Question 2:

$ sudo scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/data/mysql/installing MySQL System Tables.../usr/local/mysql//bin/mysqld:error while loading shared libraries:libaio.so.1:cannot open shared objec T file:no such file or directory

Solve:

$ sudo yum install libaio.x86_64

Question 3:

$ sudo support-files/mysql.server startstarting MySQL. error! The server quit without updating PID file (/data/mysql/localhost.localdomain.pid).
Resolution: This problem is particularly true when the first boot will be prompted, simply said to be unable to find the my.cnf file, the configuration is complete my.cnf copy to/etc/or establish a soft connection to the/etc/directory!

$ sudo cp my.cnf/etc/
Here I am a little puzzled, the surface phenomenon MySQL boot dependent/etc/my.cnf file, but the actual first normal start after MySQL can delete the/etc/my.cnf file, the second boot can load/USR/LOCAL/MYSQL/MY.CNF file normally!


Reference article:

Centos7 installing MySQL 5.6.19

CentOS 7.0 Compile and install nginx1.6.0+mysql5.6.19+php5.5.14 method share

Configuration of firewall Firewalld in RHEL7 (1)

Mysql installation (Using Generic Binaries)

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.