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

Centos detailed steps for installing MySQL5.7.18

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

Share

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

This article is to share with you centos installation MySQL5.7.18 detailed installation tutorial, I believe that most people do not know how to install, in order to let you learn, to give you a summary of the following content, without saying much, let's read on.

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. Install cmake

Tar-xzvf cmake-3.8.1.tar.gz cd cmake-3.8.1. / bootstrapmake & & make install

3. Install 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 equipped with boost_1_59_0 version

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

First, add the system account corresponding to MySQL to ensure the allocation of local file permissions:

Groupadd mysqluseradd-r-g mysql mysql

Create a database directory:

Mkdir-p / var/mysql/datachown mysql:mysql / var/mysql/data

Enter the unzipped MySQL installation package:

Cd mysql-boost-5.7.18cmake. \-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

After performing the above steps, you need to change the owner of the mysql installation directory, for example, the directory we installed is / usr/local/mysql, use the command

Chown-R mysql:mysql / usr/local/mysql

Modify the directory owner. At this point, copy a default profile

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

After installation, the blogger does not have the my-default.cnf file. You need to create it yourself and attach the contents of the file:

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# * * DO NOT EDIT THIS FILE. It's a template which will be copied to the# * * default location during install, and will 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/mysqldatadir = / usr/local/mysql/data/masterport = 3306socket = / usr/local/mysql/data/mysql.sockcharacter-set-server=utf8back_log = 300max_connections = 3000max_connect_errors = 50table_open_cache = 4096max_allowed_packet = 32M#binlog_cache_size = 4Mmax_heap_table_size = 128Mread_rnd_buffer_size = 16Msort_buffer_size = 16Mjoin_buffer_size = 16Mthread_cache_size = 16query_ Cache_size = 128Mquery_cache_limit = 4Mft_min_word_len = 8thread_stack = 512Ktransaction_isolation = REPEATABLE-READtmp_table_size = 128M#log-bin=mysql-binlong_query_time = 6server_id=1innodb_buffer_pool_size = 1Ginnodb_thread_concurrency = 16innodb_log_buffer_size = 16Minnodb_log_file_size = 512Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120innodb_file_per_table = on [mysqldump] quickmax_ Allowed_packet = 32m [MySQL] no-auto-rehashdefault-character-set=utf8safe- updates [myisamchk] key_buffer = 16Msort_buffer_size = 16Mread_buffer = 8Mwrite_buffer = 8m [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192 [client] port=3306socket=/usr/local/mysql/data/mysql.sock#default-character-set=utf8

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

Then perform the initialization of the database

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

At this time, the database will be initialized and a database root account will be created, but note that this account has a default password. The initialization password will be output on the screen during initialization. If you miss it, 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, and then execute service mysql.server start to start mysql.

Finally / usr/local/mysql/bin/mysql-rroot-p, enter the password to enter enter. If Access denied for user 'root'@'localhost' (using password: YES) appears, normally

Just restart service mysql.server restart.

After passing, 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 be used to set boot up

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

Or go to the / etc/ directory, edit the rc.local file directly by vim rc.local, add "service mysqld start" on the last line, and save the exit.

These are the detailed installation tutorials for centos to install MySQL5.7.18, which are more comprehensive, and I believe there are quite a few tools that we may see or use in our daily work. Through this article, I hope you can gain more.

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