MySQL cluster tutorial (ii) MySQL LIUNX environment construction

Source: Internet
Author: User
Tags mysql version

MySQL cluster tutorial (ii)

Build in MySQL Linux environment

A: Download: wget https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

B: Pre-installation Environment check:

1, check whether Linux installed MARIADB database, MARIADB database is the branch of MySQL, execute the command:

Yum List Installed | grep mariadb

Rpm-qa | grep mariadb

2, if Linux installed MARIADB database, first uninstall, mariadb database and install MySQL will conflict, execute the command:

Yum-y Remove mariadb-libs.x86_64

Or

Rpm-e mariadb-libs-5.5.52-1.el7.x86_64

Rpm-e postfix-2:2.10.1-6.el7.x86_64

(where mariadb-libs.x86_64 is the 1th step to search out the MARIADB software package, different machines may not be the same)

C: Installation

1. Unzip the downloaded MySQL software package and execute the command:

TAR-ZXVF mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz-c/usr/local/

(where-c/usr/local is the specified directory to extract to)

2, the decompression of the mysql-5.7.18-linux-glibc2.5-x86_64 renamed to Mysql-5.7.18

or MySQL, in order to see our MySQL version, we recommend renaming to mysql-5.7.18

Execution: MV mysql-5.7.18-linux-glibc2.5-x86_64 mysql-5.7.18

3. Create a/data/3306/folder in the mysql-5.7.18 folder directory,

Switch to mysql-5.7.18 directory, execute command;

mkdir data and then create a 3306 folder in the data directory

4. Add MySQL user and user group, execute command:

Groupadd MySQL

Useradd mysql-g MySQL

-G: Is the specified user group

5. Switch to the Mysql-5.7.18/bin directory to execute:

./mysqld--initialize-insecure--user=mysql--datadir=/usr/local/mysql-5.7.18/data/3306--basedir=/usr/local/ mysql-5.7.18

Where--initialize-insecure indicates that no temporary password is generated

6. Execute the command in the Mysql-5.7.18/bin directory:

./mysql_ssl_rsa_setup--datadir=/usr/local/mysql-5.7.18/data/3306

7, change mysql-5.7.18 the entire folder directory permissions belong to, execute the command:

Chown-r mysql:mysql/usr/local/mysql-5.7.18/

D: Configuration:

1: Create the my.cnf file in the mysql-5.7.18/data/3306 directory

2: Configure the My.cnf file

[Client]

Port = 3306

Socket =/usr/local/mysql-5.7.18/data/3306/mysql.sock

Default-character-set=utf8

[Mysqld]

Port = 3306

Socket =/usr/local/mysql-5.7.18/data/3306/mysql.sock

DataDir =/usr/local/mysql-5.7.18/data/3306

Log-error =/usr/local/mysql-5.7.18/data/3306/error.log

Pid-file =/usr/local/mysql-5.7.18/data/3306/mysql.pid

Character-set-server=utf8

Lower_case_table_names=1

Autocommit = 1

E: Start the MySQL service and execute the command in the Mysql-5.7.18/bin directory:

./mysqld_safe--defaults-file=/usr/local/mysql-5.7.18/data/3306/my.cnf & (where & symbol indicates background start)

F: Precautions after start-up

A: Change Password:

1. Log in to MySQL and execute the command in the Mysql-5.7.18/bin directory:

./mysql-uroot-p-s/usr/local/mysql-5.7.18/data/3306/mysql.sock

Where-P is the specified password, no password, you can not write-p,-s is the specified sock file

2. Modify the MySQL password to perform:

Alter user ' root ' @ ' localhost ' identified by ' 123456 ';

(where 123456 is the password we set)

B: Set up remote access

1. Authorized remote Access, execute command: (so remote client can access)

Grant all privileges on * * to [email protected] '% ' identified by ' 123456 ';

where * * The first * represents all database names, the second * represents all database tables;

[email protected] '% ' root indicates the user name,% means IP address,% can also specify specific IP address, such as [email protected],[email protected]

2, perform the following command to refresh permissions:

Flush privileges;

3, if the above authorized remote access after the execution of the remote connection is still not on the MYSQ, the Linux firewall may be blocked, you can shut down the firewall

Shutdown Firewall command: Systemctl stop firewalld (the command is temporarily off the firewall and fails after restarting CentOS)

MySQL cluster tutorial (ii) MySQL LIUNX environment construction

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.