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 install mysql 5.7.13 on linux CentOS 7 system

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

Share

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

This article mainly introduces how to install mysql 5.7.13 in linux CentOS 7 system. The things involved are learned from theoretical knowledge. There are many books and documents for your reference. From the perspective of practical significance, the accumulated practical experience for many years can be shared with you.

1. Installation environment:

[root@localhost ~] # cat / etc/redhat-releaseCentOS Linux release 7.3.1611 (Core)

Mysql version number: mysql-5.7.13-linux-glibc2.5-x86_64.tar

Configuration paths:

Download directory for installation files: / data/software (location of the package)

Mysql directory installation location: / usr/local/mysql

Database location: / data/mysql

Log location: / data/log/mysql

2. I share Baidu Cloud disk and download mysql.

Https://pan.baidu.com/s/1nuEypO9

3. Main steps of installation:

# rpm-qa | grep-I mariadb# rpm-e-- nodeps mariadb-libs-5.5.52-1.el7.x86_64

Perform the following naming:

# mkdir-p / data/software# mkdir-p / data/log/mysql # cd / data/software# (upload installation package)

Upload the mysql installation package through the xftp or rz command.

# cd / usr/local# tar-xvf / data/software/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz # mv mysql-5.7.13-linux-glibc2.5-x86_64 mysql # echo $? total ll-h 0drwxr-xr-x. 2 root root 6 November 5 2016 bindrwxr-xr-x. 2 root root 6 November 5 2016 etcdrwxr-xr-x. 2 root root 6 November 5 2016 gamesdrwxr-xr-x. 2 root root 6 November 5 2016 includedrwxr-xr-x. 2 root root 6 November 5 2016 libdrwxr-xr-x. 2 root root 6 November 5 2016 lib64drwxr-xr-x. 2 root root 6 November 5 2016 libexecdrwxr-xr-x. 9 7161 wheel 129 May 25 2016 mysql-5.7.13-linux-glibc2.5-x86_64drwxr-xr-x. 2 root root 6 November 5 2016 sbindrwxr-xr-x. 5 root root 49 August 23 00:39 sharedrwxr-xr-x. 2 root root 6 November 5 2016 src# mkdir-p / data/mysql # create a data warehouse directory # groupadd mysql-create a new msyql group # useradd-r-s-create a new msyql user, disable login to shell # cd / usr/local/mysql # chown-R mysql. # chgrp-R mysql. # chown-R mysql / data/mysql# cd / usr/local/mysql # bin/mysqld-- initialize-- user=mysql-- basedir=/usr/local/mysql-- datadir=/data/mysql# initialize mysql, remember the initial mysql password # Touch mysql.error # bin/mysql_ssl_rsa_setup-- datadir=/data/mysql# cd support-files/# cp my-default.cnf / etc/my.cnf # cp mysql.server / etc/init.d/mysql# vi / etc/init.d/mysql

Modify the blank basedir and datadir to the following configuration:

Basedir=/usr/local/mysqldatadir=/data/mysql

# vi / etc/my.cnf

Modify to the following:

[client] port = 3306socket = / opt/mysql/mysql.sock#character_set_server=utf8default-character-set=utf8 [mysql] no-auto-rehash [mysqld] # sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO NO_AUTO_CREATE_USERsql_mode=''#default-character-set=utf8socket = / opt/mysql/mysql.sockbasedir = / opt/mysqlmax_allowed_packet = 32Mdatadir = / data/mysqlexplicit_defaults_for_timestamp = trueskip-sslsecure-file-priv = NULLlower_case_table_names = 1back_log = 300max_connections = 3000max_connect_errors = 100table_open_cache = 4096external-locking = FALSEmax_allowed_packet = 32Msort_buffer_size = 128Mjoin_buffer_size = 128Mexplicit_defaults_for_timestamp = truethread_cache_size = 100query_cache_size = 256Mquery_cache_limit = 4Mft_min_word_len = 8thread_stack = 512ktransaction_isolation = REPEATABLE-READtmp_table_size = 128Mmax_heap_table_size = 128M#slow_query_logslow_query_log_file = / data/log/mysql/slow.logcharacter-set-server=utf8server_id = 1log-bin=mysqlbin-loglong_query_time = 3slow_query_log = oninnodb_buffer_pool_size = 1287m innodb_flush_log_at_trx _ commit = 2 innodb_log_buffer_size = 32m innodb_log_file_size = 512m innodb_log_files_in_group = 2 innodb_max_dirty_pages_pct = 50 innodb_file_per_table = 1 binlog_format = ROW audit_json_file=on # ensure that the plug-in starts automatically after mysql restart plugin-load=AUDIT=libaudit_plugin.so # to prevent the plug-in from being deleted After restart, audit_record_cmds='delete,update,create,drop,alter,grant,truncate' # will load which command statements to record, because all operations are recorded by default [mysqldump] quickmax_allowed_packet = 32m [mysqld _ safe] open-files-limit = 8192log-error = / data/log/mysql/mysql_3306.err

The above is the content in my.cnf

# cd / usr/local/mysql# mkdir data# chown-R mysql. # chgrp-R mysql. # bin/mysqld_safe-- user=mysql & (after execution, ps-ef | grep mysql, you can see the process of mysql) # bin/mysqld_safe-- skip-grant-tables-- user=mysql & (used when mysql is started in the background and forgets the mysql password) # bin/mysql-- user=root-p

-enter the temporary password generated in step 6

Change the mysqlroot user password:

Mysql > set password for 'root'@'localhost' = password (' redhat'); mysql > update mysql.user set authentication_string=password ('redhat') where user='root';mysql > grant all privileges on *. * to root@'%' identified by' redhat'; mysql > flush privileges;mysql > use mysql; mysql > select host,user from mysql.user; # vi / etc/profile # add mysql system path

Add:

Export PATH=/usr/local/mysql/bin:$PATH

# source / etc/profile # Import configuration # chmod 755 / etc/init.d/mysql # configure mysql Auto start # chkconfig-add mysql # configure mysql Auto start # chkconfig-level 345 mysql on # configure mysql Auto start

Log in to mysql:

# bin/mysql-user=root-p

At this point, mysql installation is complete.

Summary:

Mysql installed in this way

# systemctl stauts/start/stop mysql.service

Waiting for the operation won't work.

But...

# service mysql status/stop

Can be run

But service mysql start cannot be started. You need to use # bin/mysqld_safe-- user=mysql & to start it.

Read the above linux CentOS 7 system how to install mysql 5.7.13 introduction, I hope it can bring some help to everyone in practical application. Due to the limited space in this article, there will inevitably be deficiencies and areas that need to be supplemented. You can continue to pay attention to the industry information section and will update your industry news and knowledge regularly. 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.

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