본문 바로가기

Database/MySQL

install mysql(percona) by tarball

set limit for max open files

# cat /etc/security/limits.conf
root             soft   nofile           65536
root             hard   nofile           65536
user             soft   nofile           65536
user             hard   nofile           65536

적용 후 percona 를 설치하고 운영할 계정을 새로 로그인 한다.

set env 

# mysql
export MYSQL_HOME=$HOME/mysql
export PATH=$PATH:$MYSQL_HOME/bin
# connecthttps://www.percona.com/downloads/Percona-Server-LATEST/
# download
Percona-Server-8.0.20-11-Linux.x86_64.glibc2.12.tar.gz
# extract & symbolic link
[user@tsdb01 ~]$ cd packages/
[user@tsdb01 packages]$ ls
Percona-Server-8.0.20-11-Linux.x86_64.glibc2.12  Percona-Server-8.0.20-11-Linux.x86_64.glibc2.12.tar.gz
[user@tsdb01 packages]$ cd ..
[user@tsdb01 ~]$ ln -s packages/Percona-Server-8.0.20-11-Linux.x86_64.glibc2.12 mysql
[user@tsdb01 ~]$ ll
total 0
lrwxrwxrwx. 1 user user  56 Oct 12 05:27 mysql -> packages/Percona-Server-8.0.20-11-Linux.x86_64.glibc2.12
drwxrwxr-x. 3 user user 123 Oct 12 04:57 packages

write my.cnf

[user@tsdb01 mysql]$ mkdir etc
[user@tsdb01 mysql]$ vi etc/my.cnf
 
 
[mysqld]
datadir = /home/user/mysql/data
socket  = /home/user/mysql/data/mysql.sock
 
log-error=/home/user/mysql/data/mysqld.log
pid-file= /home/user/mysql/data/mysqld.pid
 
 
#validate_password_policy=LOW
#validate_password_length=4
 
# authentic
#default_authentication_plugin=mysql_native_password
 
max_connections=600
max_user_connections=600
 
max_allowed_packet=32M
 
open_files_limit = 8192
table_open_cache = 4000

install libaio 

[user@tsdb01 mysql]$ su -
Password:
Last login: Mon Oct 12 07:22:43 UTC 2020 on pts/1
Last failed login: Mon Oct 12 07:23:41 UTC 2020 on pts/1
There was 1 failed login attempt since the last successful login.
[root@tsdb02 ~]# yum install libaio
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: d36uatko69830t.cloudfront.net
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
base                                                                                      | 3.6 kB  00:00:00    
extras                                                                                    | 2.9 kB  00:00:00    
updates                                                                                   | 2.9 kB  00:00:00    
(1/4): base/7/x86_64/group_gz                                                             | 153 kB  00:00:00    
(2/4): extras/7/x86_64/primary_db                                                         | 206 kB  00:00:00    
(3/4): updates/7/x86_64/primary_db                                                        | 4.5 MB  00:00:00    
(4/4): base/7/x86_64/primary_db                                                           | 6.1 MB  00:00:02    
Resolving Dependencies
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=================================================================================================================
 Package                  Arch                     Version                          Repository              Size
=================================================================================================================
Installing:
 libaio                   x86_64                   0.3.109-13.el7                   base                    24 k
 
Transaction Summary
=================================================================================================================
Install  1 Package
 
Total download size: 24 k
Installed size: 38 k
Is this ok [y/d/N]: y
Downloading packages:
libaio-0.3.109-13.el7.x86_64.rpm                                                          |  24 kB  00:00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libaio-0.3.109-13.el7.x86_64                                                                  1/1
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                  1/1
 
Installed:
  libaio.x86_64 0:0.3.109-13.el7                                                                                
 
Complete!

 

initialize database

[user@tsdb01 mysql]$ bin/mysqld --no-defaults --initialize-insecure --user=user --datadir=/home/user/mysql/data  --basedir=/home/user/mysql
2020-10-12T05:31:58.460009Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-10-12T05:31:58.460112Z 0 [System] [MY-013169] [Server] /home/user/packages/Percona-Server-8.0.20-11-Linux.x86_64.glibc2.12/bin/mysqld (mysqld 8.0.20-11) initializing of server in progress as process 10488
2020-10-12T05:31:58.466902Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-10-12T05:31:59.591791Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-10-12T05:32:00.589394Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

 

install plugin

[user@tsdb01 mysql]$ su -
Password: ( some-word )
Last login: Mon Oct 12 05:18:19 UTC 2020 on pts/1
[root@tsdb01 ~]# cd ~user/mysql
[root@tsdb01 mysql]# bin/mysql -uroot --socket=/home/user/mysql/data/mysql.sock -p ( percona root 는 os root 계정만 접속 가능 )
Enter password: (그냥 엔터)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.20-11 Percona Server (GPL), Release 11, Revision 159f0eb


Copyright (c) 2009-2020 Percona LLC and/or its affiliates
Copyright (c) 2000, 2020, 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> select plugin_name, plugin_status from information_schema.plugins where plugin_name like 'validate%';
Empty set (0.00 sec)


mysql> install plugin validate_password soname 'validate_password.so';
Query OK, 0 rows affected, 1 warning (0.01 sec)




# 설치 이후에 validate 관련 옵션과 default_authentication_plugin 옵션의 주석을 해제 한다.

 

create user

mysql> create user user@'%' identified by "some-word";
Query OK, 0 rows affected (0.01 sec)

'Database > MySQL' 카테고리의 다른 글

semi replication  (0) 2021.10.01
mysql admin script  (0) 2021.10.01
MySQL partition 관리  (0) 2021.10.01
InnoDB on-disk structures  (0) 2021.10.01
InnoDB Adaptive Hash index  (0) 2021.10.01