Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL5.6 binary package installation process handout

Shulou Source: shulou.com Published: 2022-06-01 20:19:11 10月26日 Update

This article mainly introduces the MySQL5.6 binary package installation process handout, I hope you can add and update some knowledge, if you have other questions to understand, you can continue to follow my updated article in the industry information.

The advantage of MySQL installation based on binary format is that it is specially optimized for a specific platform, and it can be decompressed directly without considering the requirements of the environment. This article is based on the MySQL5.6.38 version and can be downloaded from:

Https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz

1. Download the MySQL binary package:

[root@localhost ~] # mkdir / root/soft/-pv [root@localhost ~] # cd soft/ [root@localhost soft] # wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz

2. Decompress to / usr/local:

[root@localhost soft] # tar xf mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz-C / usr/local/

3. Create a soft link:

[root@localhost soft] # cd / usr/local/ [root@localhost local] # ln-sv mysql-5.6.38-linux-glibc2.12-x86_64/ mysql

4. Create a mysql data directory:

[root@localhost ~] # mkdir / data/mydata-pv

4. Create mysql users, mysql groups, and authorized data directories:

[root@localhost] # groupadd-r mysql [root@localhost ~] # useradd-r-g mysql-s / sbin/nologin-M-d / data/mydata mysql [root@localhost ~] # chown-R mysql:mysql / data/mydata/

5. Initialize the database:

[root@localhost ~] # cd / usr/local/mysql [root@localhost mysql] # chown-R mysql.mysql. [root@localhost mysql] #. / scripts/mysql_install_db-- basedir=/usr/local/mysql-- datadir=/data/mydata/-- user=mysqlFATAL ERROR: please install the following Perl modules before executing. / scripts/mysql_install_db:Data::Dumper

Here there is an error prompt that I have not installed the Perl module, so I installed the perl-devel,perl and other software packages as usual, and then initialized the data and found that there was still an error. I searched for the original perl-Data-Dumper.x86_64 0perl-Data-Dumper.x86_64 2.145-3.el7 package, and the error message is very obvious. OK, next time I must read the wrong information. The solution is also very simple, just yum install.

[root@localhost mysql] # yum list perl-Data-DumperLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.cn99.com * updates: centos.ustc.edu.cnAvailable Packagesperl-Data-Dumper.x86_64 [root@localhost mysql] # yum install perl-Data-Dumper-y

Execute again:

[root@localhost mysql] # / scripts/mysql_install_db-- basedir=/usr/local/mysql-- datadir=/data/mydata/-- user=mysqlInstalling MySQL system tables.../usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

Another error occurred, this prompt indicates that the libaio module does not exist, OK, we will pretend what is missing.

[root@localhost mysql] # yum install libaio-y

Then execute the mysql_install_db script to initialize the database, this time there is no error, when you see the word OK, it means that the database initialization is complete.

6, set up the mysql database configuration file. Note that there is only one default configuration file, my-default.cnf, in the support-files directory under the mysql5.6 decompression directory, and there is basically no configuration and mostly comments, which is quite different from mysql5.5. There will be a configuration file such as my-huge.cnf my-innodb-heavy-4G.cnf my-large.cnf my-medium.cnf my-small.cnf in this directory, which you can choose according to your own CVM. In that case, you can only configure my.cnf on your own.

[root@localhost ~] # vi / etc/my.cnf [client] # password = your_passwordport = 3306socket = / tmp/ mysql.sock [mysqld] port = 3306socket = / tmp/mysql.sock#datadir = / usr/local/mysql/vardatadir = / data/mydata/basedir = / usr/local/mysql/pid-file = / data/mydata/mysql.pidskip-external-lockingkey_buffer_size = 16Mmax_allowed_packet = 1Mtable _ open_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_size = 256Kread_rnd_buffer_size = 512Kmyisam_sort_buffer_size = 8Mthread_cache_size = 8query_cache_size = 8Mtmp_table_size = 16M#skip-networkingmax_connections = 500max_connect_errors = 100open_files_limit = 65535log-bin=mysql-binbinlog_format=mixedserver-id = 1expire_logs_days = 10default_storage_engine = InnoDBinnodb_file_per_table = 1innodb_data_home_dir = / data / mydata/innodb_data_file_path = ibdata1:10M:autoextendinnodb_log_group_home_dir = / data/mydata/innodb_buffer_pool_size = 16Minnodb_additional_mem_pool_size = 2Minnodb_log_file_size = 5Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 50 [mysqldump] quickmax_allowed_packet = 16m [MySQL] no-auto- rehash [myisamchk] key_buffer_size = 20Msort_buffer_size = 20Mread_ Buffer = 2Mwrite_buffer = 2m [mysqlhotcopy] interactive-timeout

7, export the PATH environment variable:

[root@localhost] # echo "export PATH=$PATH:/usr/local/mysql/bin" > / etc/profile.d/mysql.sh [root@localhost ~] #. / etc/profile.d/mysql.sh

8. Export the mysql header file to the system header directory:

[root@localhost ~] # ln-sv / usr/local/mysql/include / usr/include/mysql

9. Output the path from the mysql library file to the system library file:

[root@localhost ~] # echo'/ usr/local/mysql/lib' > / etc/ld.so.conf.d/mysql.conf [root@localhost ~] # ldconfig-v

10. Start the mysqld service:

[root@localhost mysql] # cp support-files/mysql.server / etc/init.d/mysqld [root@localhost mysql] # chkconfig mysqld on [root@localhost mysql] # / etc/init.d/mysqld start

Note here that the / etc/init.d/mysqld script has the following changes:

Basedir=/usr/local/mysqldatadir=/data/mydata/mysqld_pid_file_path=/data/mydata/mysql.pid

At this point, mysql has already started:

[root@localhost mysql] # mysqlWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 4Server version: 5.6.38-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > mysql > use mysql Database changedmysql > delete from mysql.user where (user,host) not in (select 'root',' localhost'); # Delete redundant users mysql > update user set password=password ('QWER@@111') where user='root'; # modify root password Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql > select user,host,password from user +-+ | user | host | password | +- -- + | root | localhost | * 16FF293CF039130E27DC275D8B47EBB0754FFE9F | +-+ 1 row in set (0.00 sec) mysql > flush privileges Query OK, 0 rows affected (0.00 sec)

At this point, the MySQL database installation is complete.

Read the above on the MySQL5.6 binary package installation process handouts, I hope to give you some help in practical application. Due to the limited space in this article, it is inevitable that there will be deficiencies and need to be supplemented. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

Tags: Data directories databases files configurations binaries prompts methods processes handouts information places library files modules environments users systems scripts questions updates Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Information NVidia macOS OPPO Reno