Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief Analysis of using binary method to install MySQL5.7.13

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following mainly brings you a brief analysis of using binary method to install MySQL5.7.13. I hope these words can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

Installation environment: Centos6.8

Purpose: to install MySQL5.7.13 through universal binary (Generic Binary)

Required software: mysql-5.7.13-linux-glibc2.5-x86_64.tar (please download it from MySQL's official website)

Steps:

1. Create mysql users, mysql groups

Groupadd-g 3306 mysql

Useradd-g mysql-u 3306-s / sbin/nologin-M mysql

Id mysql # check whether the creation is successful

two。 Create an MySQL data directory as a logical volume.

[root@localhost] fdisk / dev/sda

N # create a new partition

Enter # the new partition uses the default track initial number

+ 2G # create a new 2G partition

T # modify the type of partition

9 # the new partition on my system is the ninth, so press 9

8e # modified to LVM type

W # Save exit

[root@localhost] partprobe # tells the kernel to read the partition table

Reboot # restart the Linux system

Pvcreate / dev/sda9

Vgcreate myvg / dev/sda9

Lvcreate-L 1G-n mydata myvg # create logical volumes

Mke2fs-j / dev/myvg/mydata # formats logical volumes as ext3 file systems

Mkdir / mydata # create a mount directory

Modify / etc/fstab setting for boot auto mount / dev/myvg/mydata

Vim / etc/fstab

Add the last line / dev/myvg/mydata / mydata ext3 defaults 0 0

Mount-a # Mount logical Volume

Df # check whether the logical volume is hung on the

Chown-R mysql.mysql / mydata/data/

Chmod-R750 / mydata/data # these two steps are very critical, which are directly related to whether you have permission to read and write data under the / mydata/data/ directory when initializing the database.

3. Extract the general binary package of mysql to the / usr/local directory

Cd / usr/local

Tar xf mysql-5.7.13-linux-glibc2.5-x86_64.tar

# unzipped and generated two compressed packages, of which the mysql-test-5.7.13-linux-glibc2.5-x86_64.tar.gz package was not deleted

Tar xf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

Ln-sv mysql-5.7.13-linux-glibc2.5-x86_64 mysql # create a soft link

Cd mysql # found these directories bin COPYING lib README share support-files

Modify the permission chown-R mysql.mysql. # this step is very important, don't forget to modify the permission

The most important directories are support-files and bin.

Inside support-files is the sample configuration file of mysql and the service startup script.

Bin stores important commands of mysql (for initializing database, backup, replication, etc.)

The / bin/mysql_install_db command was used to initialize the database before version 5.7. after version 5.7, the command was discarded and / bin/mysqld was used to initialize the database instead.

Bin/mysqld-- initialize-insecure-- user=mysql-- datadir=/mydata/data # initializes the database and specifies the data directory-- initialize-insecure is used to initialize the database and no password is generated. If you use-- initialize, a random initial password will be generated for the database. Be sure to generate a password for mysql in the production environment.

Cp / support_files/mysql.server / etc/init.d/mysqld # provides service scripts

4. Provide configuration files for mysql

This is my configuration file, in which only the simplest configuration has been made, and the corresponding parameters can be configured later according to specific needs.

Less / etc/my.cnf

[client]

Port=3306

Socket=/tmp/mysql.sock

[mysqld]

Datadir = / mydata/data/

Port=3306

Socket=/tmp/mysql.sock

Key_buffer_size=16M

Max_allowed_packet=8M

5. Let's start the database.

Service mysqld start # OK indicates that the startup is successful

The netstat-tulnp # 3306 port is indeed listening.

Mysql-uroot-p # because there is no password, you can directly enter to connect to mysql. The following interface appears, which shows that it is successful.

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 2

Server version: 5.7.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | sys |

+-+

4 rows in set (0.00 sec)

Mysql > create database mydb

->

Query OK, 1 row affected (0.00 sec)

Mysql > use mydb

Database changed

Mysql > create table mytb (id int auto_increment primary key)

Query OK, 0 rows affected (0.02 sec)

For the above about the use of binary installation of MySQL5.7.13 brief analysis, we do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report