Picking up the flowers: Linux CentOS 7 installing MySQL 5.7.13

Source: Internet
Author: User

1. Installation Environment:

[Email protected] ~]# cat/etc/redhat-releasecentos Linux release 7.3.1611 (Core)

Mysql Version number: Mysql-5.7.13-linux-glibc2.5-x86_64.tar

Each configuration path:
installation File download directory:/data/software (Package location)
MySQL Directory Installation location:/usr/local/mysql
Database Save location:/data/mysql
Log Save location:/data/log/mysql

2 . I Baidu cloud disk share, download MySQL
Https://pan.baidu.com/s/1nuEypO9

3. Install the main steps:

# 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 via 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 $?0# ll -h Total Dosage  0drwxr-xr-x. 2 root root     6 11 Month   5 2016 bindrwxr-xr-x. 2 root root     6 11 Month   5 2016 etcdrwxr-xr-x. 2 root root     6 11 Month   5 2016 gamesdrwxr-xr-x. 2 root root     6 11 Month   5 2016 includedrwxr-xr-x. 2 root root     6 11 Month   5 2016 libdrwxr-xr-x. 2 root root     6 11 Month   5 2016 lib64drwxr-xr-x. 2 root root     6 11 Month  &nbsP;5 2016 libexecdrwxr-xr-x. 9 7161 wheel 129 5 Month   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 8 Month    23 00:39 sharedrwxr-xr-x. 2 root root    6 11 month    5 2016 src# mkdir -p /data/mysql       #创建数据仓库目录 #  groupadd mysql    ---Create a new MSYQL group  # useradd -r -s     ---New MSYQL user, disable login 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  #初始化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 content:

[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     #保证mysql重启后自动启动插件plugin-load=audit=libaudit_plugin.so      #防止删除了插件, reboot will load audit_record_cmds= ' delete,update,create,drop,alter,grant,truncate '     #要记录哪些命令语句 because all operations are logged 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 & (PS after execution –ef|grep MySQL, can see the process of MySQL) # Bin/mysqld_safe--skip-grant-tables--user=mysql & (in the background to start MySQL, and forget the MySQL password used) # bin/ MySQL--user=root-p

-- Enter the temporary password generated by step 6th

To modify 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 [email protected] '% ' identified by ' Redhat '; mysql> flush privileges;mysql> use MySQL; Mysql> select Host,user from Mysql.user;
# vi/etc/profile # Add MySQL system path

Add to:
Export Path=/usr/local/mysql/bin: $PATH

# source/etc/profile #导入配置 # chmod 755/etc/init.d/mysql # configure MySQL autostart # chkconfig--add MySQL #配置mysq L Auto Start # chkconfig--level 345 MySQL on #配置mysql自动启动

Log in to MySQL:

# Bin/mysql--user=root-p

This completes the MySQL installation.

Summarize:

This way the installation of MySQL,

# Systemctl Stauts/start/stop Mysql.service


Operation does not work.


But

#service MySQL Status/stop

can run;

But service MySQL start does not start, need to use: # Bin/mysqld_safe--user=mysql & to start


Picking up the flowers: Linux CentOS 7 installing MySQL 5.7.13

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.