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

How to build the tar of mysql5.5&mysql5.6 under linux

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces how to build the tar of mysql5.5&mysql5.6 under linux. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Install dependency packages ahead of time with yum

Yum-y install perl perl-devel libaio* 'perl (Data::Dumper)'

Get mysql's tar package ready.

1. Extract the installation package of mysql under / usr/local, and rename the extracted file to mysql, which executes the command.

Tar zxvf mysql-5.6.16-linux-glibc2.5-x86_64.tar decompression

Rename mv mysql-5.6.16-linux-glibc2.5-x86_64 mysql

2. Establish the mysql user and grant the permissions to the / usr/local/mysql directory

Useradd mysql build users

Chown mysql:mysql-R mysql weighting

3. Set up a data directory and give the directory rights to mysql users

Mkdir-p / data/mysql build data directory

Chown mysql:mysql-R / data weighting

To check whether the authorization is successful, you can view the user and permissions in its directory and ll.

4. Configuration file

Create a new my.cnf file in the / etc directory and edit the configuration file

Vim / etc/my.cnf creates and edits the configuration file to write the following

Note: the following configuration is suitable for the master library. To use the slave library, you need to annotate the event event_scheduler = 1 in the configuration.

[client] port = 3306socket = / data/mysql/mysql.sock#default-character-set= UTF8 [MySQL] prompt = "mysql [\ d] >\ _" # default-character-set= UTF8 [mysqld] port = 3306socket = / data/mysql/mysql.sockbasedir = / usr/local/mysqldatadir = / data/mysqlopen_files_limit = 3072back_log = 103max_connections = 512max_connect_errors = 100000table_open_cache = 512external-locking = FALSEmax_allowed_packet = 32Msort_buffer_size = 2Mjoin_buffer_size = 2Mthread _ cache_size = 51query_cache_size = 32Mtmp_table_size = 96Mmax_heap_table_size = 96Mslow_query_log = 1slow_query_log_file = / data/mysql/slow.loglog-error = / data/mysql/error.loglong_query_time = 2event_scheduler = 1 lower_case_table_names = 1log-bin-trust-function-creators=1server-id = 1log-bin = / data/mysql/mysql-binsync_binlog = 1binlog_cache_size = 4Mmax_binlog_cache_size = 8Mmax_binlog _ size = 1024Mexpire_logs_days = 7key_buffer_size = 32Mread_buffer_size = 1Mread_rnd_buffer_size = 16Mbulk_insert_buffer_size = 64Mcharacter-set-server=utf8default-storage-engine = InnoDBbinlog_format=row#gtid_mode=on#log_slave_updates=1#enforce_gtid_consistency=1transaction_isolation = REPEATABLE-READinnodb_additional_mem_pool_size = 16Minnodb_buffer_pool_size = 1434Minnodb_data_file_path = ibdata1:1024M:autoextendinnodb_flush_log_at_trx_commit = 1innodb_log_buffer_size = 16Minnodb_log_file_size = 256Minnodb_log_files_in_group = 2innodb_max_dirty_pages_pct = 50innodb_file_per_table = 1innodb_locks_unsafe_for_binlog = 0 [mysqldump] quickmax_allowed_packet = 32m

5. Initialize the database

/ usr/local/mysql/scripts/mysql_install_db-defaults-file=/etc/my.cnf-basedir=/usr/local/mysql-datadir=/data/mysql/-user=mysql

Initialization error: [root@localhost data] # / usr/local/mysql/scripts/mysql_install_db-- defaults-file=/etc/my.cnf-- datadir=/data/mysql/-- basedir=/usr/local/mysql-- user=mysqlCan't locate Data/Dumper.pm in @ INC (@ INC contains: / usr/local/lib64/perl5 / usr/local/share/perl5 / usr/lib64/perl5/vendor_perl / usr/share/perl5/vendor_perl / usr/lib64/perl5/ usr/share/perl5.) At / usr/local/mysql/scripts/mysql_install_db line 42.BEGIN failed--compilation aborted at / usr/local/mysql/scripts/mysql_install_db line 42. Solution: yum install 'perl (Data::Dumper)'

6. Start the database

/ bin/mysqld_safe-defaults-file=/etc/my.cnf &

Or start the script through the cp database

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld

Chmod + x / etc/init.d/mysqld

Start: / etc/init.d/mysqld start

Close: / etc/init.d/mysqld stop

7. Add to Boot

Chkconfig-add mysqld

Chkconfig-- list mysqld to check the enabled level of mysql

Chkconfig-- level 0 mysqld on

8. Pay attention to configuring environment variables

9. For slave library configuration, please add the following parameters. Remember to note that the server_id of master and slave cannot be the same.

Log_slave_updates=1relay-log=/data/mysql/relay-log-binrelay-log-index=/data/mysql/slave-relay-bin.indexmax_relay_log_size=300M# turns off automatic deletion of relay-logrelay_log_purge=0 so much about how to build the tar of mysql5.5&mysql5.6 under linux. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

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

Database

Wechat

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

12
Report