Installing MySQL5.7.18 under the CentOS system

Source: Internet
Author: User
Tags change settings openssl

1. Install the dependency package first

Yum install-y gcc gcc-c++ ncurses-devel perl OpenSSL-devel

Most importantly, don't forget to install OpenSSL-devel

2, installation CMake

TAR-XZVF cmake-3.8.1.tar.gz
CD cmake-3.8.1
./bootstrap
Make && make install

3, Installation MySQL5.7.18

First download the installation package, my installation version is: mysql-boost-5.7.18.tar.gz

Need to download boost, I am supporting the boost_1_59_0 version

Download and unzip in the/usr/local directory and rename it to boost

The first is to add a MySQL corresponding system account, which is used to guarantee the local File permission assignment:

Groupadd MySQL
Useradd-r-G MySQL MySQL

To create a database directory:

Mkdir-p/var/mysql/data
Chown Mysql:mysql/var/mysql/data

Enter the extracted MySQL installation package:

CD mysql-boost-5.7.18

CMake. \
-dcmake_install_prefix=/usr/local/mysql/\
-dinstall_datadir=/usr/local/mysql/data/master \
-DSYSCONFDIR=/USR/LOCAL/MYSQL/ETC \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dextra_charsets=all \
-dwith_ssl=system \
-dwith_embedded_server=1 \
-denabled_local_infile=1 \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_archive_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_partition_storage_engine=1 \
-dwith_perfschema_storage_engine=1 \
-dmysql_user=mysql \
-dmysql_unix_addr=/usr/local/mysql/data/mysql.sock \
-ddownload_boost=1 \
-dwith_boost=/usr/local/boost

If an error occurs, after modification, you need to delete the CMakeCache.txt file in the current directory and then re-cmake

Make && make install

To complete the above steps, you need to change the MySQL installation directory owner, such as our installed directory is/usr/local/mysql, using the command

Chown-r Mysql:mysql/usr/local/mysql

Modify the directory owner. At this point, copy the default configuration file

Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf

Bo master installation completed without my-default.cnf This file, you need to create, attach the contents of the file:

#For Advice on how to change settings
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# * * * Don't EDIT this FILE. It ' s a template which 'll be copied to the
# * * * default location during install, and would be replaced if you
# * * * * Upgrade to a newer version of MySQL.

[Mysqld]
#aracter_set_server =utf8
#init_connect = ' SET NAMES UTF8 '


Sql_mode=no_engine_substitution,strict_trans_tables

# General configuration options
Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data/master
Port = 3306
socket =/usr/local/mysql/data/mysql.sock
Character-set-server=utf8


Back_log =
max_connections =
max_connect_errors =
Table_open_cache = 4096
Max_allowed_packet = 32M
#binlog_cache_size = 4M

max_heap_table_size = 128M
read_rnd_buffer_size = 16M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size =
query_cache_size = 128M
query_cache_limit = 4M
Ft_min_word_len = 8

Thread_stack = 512K
transaction_isolation = Repeatable-read
tmp_table_size = 128M
#log-bin=mysql-bin
Long_query_time = 6


server_id=1

innodb_buffer_pool_size = 1G
innodb_thread_concurrency =
innodb_log_buffer_size = 16M


innodb_log_file_size = 512M
Innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct =
innodb_lock_wait_timeout =
innodb_file_per_table = on

[mysqldump]
Quick

Max_allowed_packet = 32M

[MySQL]
No-auto-rehash
Default-character-set=utf8
safe-updates

[Myisamchk]
Key_buffer = 16M
sort_buffer_size = 16M
Read_buffer = 8M
Write_buffer = 8M

[Mysqlhotcopy]
Interactive-timeout

[Mysqld_safe]
open-files-limit = 8192

[Client]
port=3306
Socket=/usr/local/mysql/data/mysql.sock
#default-character-set=utf8

If you are prompted to overwrite the file, you can overwrite it.

Then perform the initialization of the database,

/usr/local/mysql/bin/mysqld--initialize--user=mysql,

This is the time to initialize the database and create a database root account, but note that this account has a default password, the initialization of the screen will output the initial password, if missed, you can see the default password by viewing/root/.mysql_secret.

Execute CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MYSQL.SERVER/ETC/INIT.D, copy the service startup script for MySQL to the past, and then perform service mysql.server start Mysql.

Finally/usr/local/mysql/bin/mysql-rroot-p, enter the password return if the access denied for user ' root ' @ ' localhost ' (using Password:yes) is present, typically

Service Mysql.server Restart reboot

After that, you can reset the root password with the following command

Set Password=password (' Your password ');

At this point, the basic installation process is complete

The following methods can set the boot start

Command echo "service mysqld start" >>/etc/rc.local

Or go to/etc/directory, direct vim rc.local edit rc.local file, add "service mysqld start" in the last line, save exit

Installing MySQL5.7.18 under the CentOS system

Related Article

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.