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

MySQL 5.7.22 binary installation

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

MySQL 5.7.22 binary installation

Download the mysql-5.7.22 binary package from the official website

2. Create mysql users:

Useradd mysql-s / sbin/nologin-M

3. Decompress mysql-5.7.22-el7-x86_64.tar.gz:

Tar xf mysql-5.7.22-el7-x86_64.tar.gz & & mv mysql-5.7.22-el7-x86_64.tar.gz / opt/mysql

4. Create relevant directories:

Cd / opt/mysql mkdir {data,logs,etc} mkidr logs/binlog

5. Modify permissions:

Cd / opt/ & & chown-R mysql.mysql mysql

6. Initialize the database:

Cd / opt/mysql. / bin/mysqld-- initialize-- user=mysql-- basedir=/opt/mysql-- datadir=/opt/mysql/data remember the last password prompted

7. Modify the my.cnf file:

Echo > / etc/my.cnf vi my.cnf adds the last content of the document

8. Configure mysql service:

Cd / opt/mysql & & cp support-files/mysql.server / etc/init.d/mysqld modify permissions chmod + x / etc/init.d/mysqld Edit mysqld join basedir=/opt/mysql datadir=/opt/mysql/data chkconfig-- add mysqld

9. Start mysql service:

Service mysqld start will report a log error: Starting MySQL.2018-07-26T14:24:53.192088Z mysqld_safe error: log-error set to'/ opt/mysql/logs/mysql-error.log', however file don't exists. Create writable for user 'mysql'. ERROR! The server quit without updating PID file (/ opt/mysql/data/mysql.pid). The reason is that the mysql-error.log file under logs cannot be found. We can manually create a touch / opt/mysql/logs/mysql-error.log&&chown mysql.mysql mysql-error.log and then execute service mysqld start.

10. Configure environment variables:

Cd & & vi .bash _ profile add / opt/mysql/bin after PATH, save and exit execution source .bash _ profile

Log in to the database and change the password:

After starting the service, performing mysql-uroot-p entering the initialization password to execute show databases; will report an error ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. Execute set PASSWORD=PASSWORD ('123456'); flush privileges can log in again after changing the password and exiting with the new password

At this point, the Mysql-5.7.22 binary installation is complete.

My.cnf optional content [mysqld] # sql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLESbasedir=/opt/mysql # Media Directory datadir=/opt/mysql/data # data Directory port=3306 # Port pid-file = / opt/mysql/data/mysql.pid # process id user = mysql # launch user socket=/opt/mysql/data/mysql.sock # sock file address bind-address = 0.0.0.0 # bind ip here means to bind all ipserver-id = 1 # to copy the environment clock ID instance This is the only character-set-server = utf8 # server default character set in the replication environment, which is very important. The error setting will cause garbled max_connections = 1000 # the maximum number of concurrent connections allowed by the client max_connect_errors = 6000 # if the number of errors the client tries to connect exceeds the value set by this parameter The server no longer accepts new client connections. Open_files_limit = 65535 # the number of files that the operating system allows the MySQL service to open. Table_open_cache = 128 # the number of tables that all threads can open max_allowed_packet = 4m # the size of a single packet when transmitted over the network. Back_log= 300binlog_cache_size = 4Mmax_heap_table_size = 8Mtmp_table_size = 16Mread_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 4Mthread_cache_size = 8query_cache_type = 1query_cache_size = 8Mquery_cache_limit = 2Mft_min_word_len = 4log_bin = mysql-binbinlog_format = mixedexpire_logs_days = 30log_error = / opt/mysql/logs/mysql-error.logslow_ Query_log = 1long_query_time = 1slow_query_log_file = / opt/mydql/logs/mysql-slow.logperformance_schema = 0explicit_defaults_for_timestamp#lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush _ log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800#lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer _ size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800 [client] port=3306socket=/opt/mysql/data/ mysql.sock [MySQL] no-auto-rehash#default-character-set=utf8safe-updatessocket=/opt/mysql/data/ mysql.sock [mysqldump] quickmax_allowed_packet = 32m [mysqlhotcopy] interactive- timeout [MySQL _ safe] open-files-limit = 8192

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