CentOS 7.5 Percona Server 5.7のインストールと構成
15198 ワード
個人的にはMYSQLの軽さが好きで、今日は少し時間をかけてアリ雲の上のMYSQL 5を7 Percona-Serverに変更しました.PerconaはオープンソースのMySQL派生版で、TokuDBのデータベースエンジンはPerconaサーバに非常に魅力的で、高性能、高信頼性、高価格比のソリューションが必要な場合は、良い選択になります.
Percona Server 5.7 comes with the TokuDB storage engine. You can find more information on how to install and enable the TokuDB storage in the TokuDB Installation guide.
Installing Percona Server
セキュリティ構成(mysql以外の公式ドキュメントはmysql 6.xバージョンのみ)
符号化の変更(必須ではありませんmysql 8.0デフォルト
dockerコンテナ運転https://hub.docker.com/u/percona/https://www.percona.com/doc/percona-server/LATEST/installation/docker.html
その他の質問
ダウンロードが遅い場合は、国内ソースを交換してください
apt
Percona Server 5.7 comes with the TokuDB storage engine. You can find more information on how to install and enable the TokuDB storage in the TokuDB Installation guide.
Installing Percona Server
#
systemctl stop firewalld.service
systemctl disable firewalld.service
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm
yum list | grep percona
yum install Percona-Server-server-57
# mysql
systemctl restart mysqld.service
systemctl enable mysqld.service
systemctl status mysqld.service
#
/etc/my.cnf
/var/lib/mysql
/var/log/mysqld.log
# mysql
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
#
use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
セキュリティ構成(mysql以外の公式ドキュメントはmysql 6.xバージョンのみ)
[root@iZ11fek1j6cZ lib]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
符号化の変更(必須ではありませんmysql 8.0デフォルト
utf8mb4
)vi /etc/my.cnf
[client]
default-character-set = utf8
[mysqld]
default-storage-engine = INNODB
character-set-server = utf8
collation-server = utf8_general_ci
#
[root@iZ11fek1j6cZ etc]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[root@iZ11fek1j6cZ etc]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.15-9 Percona Server (GPL), Release 9, Revision 9f0fd0a
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, 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 variables like '%char%';
+--------------------------------------+-------------------------------------+
| Variable_name | Value |
+--------------------------------------+-------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/percona-server/charsets/ |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------------------------------------+
9 rows in set (0.00 sec)
[mysqld]
...
character_set_server=utf8mb4
collation_server=utf8mb4_0900_ai_ci
skip-character-set-client-handshake
sort_buffer_size=512K
dockerコンテナ運転https://hub.docker.com/u/percona/https://www.percona.com/doc/percona-server/LATEST/installation/docker.html
# docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
#yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce
sudo systemctl enable docker && systemctl start docker
sudo docker run hello-world
sudo systemctl status docker
# portainer
docker pull portainer/portainer
docker images
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
docker run -d \
--name percona-Server-server-57 \
-e MYSQL_ROOT_PASSWORD=JUST_PWD \
percona/percona-server:5.7 \
--character-set-server=utf8 \
--collation-server=utf8_general_ci
その他の質問
ダウンロードが遅い場合は、国内ソースを交換してください
#
https://mirrors.tuna.tsinghua.edu.cn/percona/release/7/RPMS/x86_64/repodata/
http://mirrors.ustc.edu.cn/percona/release/7/RPMS/x86_64/repodata/
########################################
# Percona releases and sources, stable #
########################################
[percona-release-$basearch]
name = Percona-Release YUM repository - $basearch
#baseurl = http://repo.percona.com/release/$releasever/RPMS/$basearch
baseurl = https://mirrors.tuna.tsinghua.edu.cn/percona/release/$releasever/RPMS/$basearch
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona
apt
sudo apt update && sudo apt upgrade
update update /etc/apt/sources.list /etc/apt/sources.list.d , 。 upgrade upgrade , , , upgrade update, 。 An update should always be performed before an upgrade or dist-upgrade. upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded.
REFER: https://www.percona.com/doc/percona-server/LATEST/installation.html
https://www.percona.com/doc/percona-server/LATEST/performance/threadpool.html
https://dev.mysql.com/doc/refman/8.0/en/innodb-buffer-pool-resize.html
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
https://www.percona.com/doc/percona-server/5.7/installation/yum_repo.html
https://www.percona.com/doc/percona-server/5.7/installation/apt_repo.html
どうして私はMariaDBを見ないの?http://www.innomysql.com/article/25821.html
MySQL、Postgresがリモートアクセスを開始(ubuntu)http://wenzhixin.net.cn/2012/05/15/mysql_open_the_remote_access_ubuntu