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

Mysql5.7 binary installation notes

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Check whether the system has installed mysql or its dependencies, and delete it first if it has been installed, otherwise an error will be reported when installing with yum in step 4:

[root@mysql01 Packages] # yum list installed | grep mysql

Mysql-libs.x86_64 5.1.73-5.el6_6 @ anaconda-CentOS-201508042137.x86_64/6.7

[root@mysql01 Packages] # yum-y remove mysql-libs.x86_64

1. Create a location for the installation package

Mkdir / soft

two。 Edit configuration file

Vim / etc/my.cnf

3. Extract the binary installation package

Tar-xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

View dependency packages: ldd bin/mysqld

Root@mysql01 mysql3306] # cd / soft/mysql-5.7.24-linux-glibc2.12-x86_64

[root@mysql01 mysql-5.7.24-linux-glibc2.12-x86_64] # ls

Bin COPYING docs include lib man README share support-files

[root@mysql01 mysql-5.7.24-linux-glibc2.12-x86_64] # ldd bin/mysqld

4.

Mv mysql-5.7.21-linux-glibc2.12-x86_64 / usr/local/mysql

Cd / usr/local/

Ln-s / soft/mysql-5.7.24-linux-glibc2.12-x86_64 mysql

Chown-R mysql:mysql mysql/

5.

Useradd mysql

Groupadd mysql

Create an account without shell

Useradd-g mysql-d / usr/local/mysql-s / sbin/nologin-MN mysql

MN: does not create a home directory or any hidden files under the directory

6. Create

Mkdir-p / data/mysql/mysql3306/data

Mkdir-p / data/mysql/mysql3306/logs

Mkdir-p / data/mysql/mysql3306/tmp

Chown-R mysql:mysql / data/mysql/

7.

Vim / etc/my.cnf

Innodb_buffer_pool_size = 512m

9. Modify the configuration file

Vim / etc/profile

Export MYSQL_HOME=/usr/local/mysql

PATH=$PATH:$MYSQL_HOME/bin

Take effect

Source / etc/profile

10. Initialization

/ usr/local/mysql/bin/mysqld-defaults-file=/data/mysql/my3306.cnf-initialize-insecure-basedir=/usr/local/mysql-datadir=/data/mysql/mysql3306/data-user=mysql

twelve。 Start

Mysqld_safe-- user=mysql &

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

/ usr/local/mysql/bin/mysqld-defaults-file=/data/mysql/my3306.cnf &

Log in

Mysql-S / tmp/mysql3306.cnf-p

Mysql-S / data/mysql/mysql3306.sock-p

Modify root password

Mysql > SET PASSWORD = 'root123'

Query OK, 0 rows affected (0.01 sec)

Set to never expire

Mysql > ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER

Query OK, 0 rows affected (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.01 sec)

[root@mysql01 mysql3306] # mysql-uroot-proot123

Root@mysql01 06:34: [(none)] > create database qixin

Root@mysql01 06:34: [(none)] > use qixin

Root@mysql01 06:34: [qixin] > show tables

Root@mysql01 06:34: [qixin] > show databases

Multiple instances

Mkdir-p / home/mysql3307/mysql3307

Mkdir-p / home/mysql3307/logs

Chown mysql.mysql-R / home/mysql3307

Initialization

Mysqld-defaults-file=/data/mysql/my3307.cnf-initialize-insecure-basedir=/usr/local/mysql-datadir=/data/mysql/mysql3307/data-user=mysql

Start

Mysqld_safe-defaults-file=/data/mysql/my3307.cnf-user=mysql &

Mysqld-defaults-file=/data/mysql/my3306.cnf & this is recommended

/ usr/local/mysql/bin/mysqld_multi start 3306 official maintenance is no longer under way

/ usr/local/mysql/bin/mysqld-- verbose-- help | grep my.cnf can view the loading of configuration files

/ usr/local/mysql/bin/perror 27

Close the library:

Mysqladmin-S / tmp/mysql3306.sock-pzstzst shutdown

Mysql > shutdown

8.0 installation

Do not retain the original file to extract:

Xz-d mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz

Tar-xvf mysql-8.0.17-linux-glibc2.12-x86_64.tar

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