In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
How to install mysql5.7
There are three ways to install MySQL: {1; source code compilation, 2; binary installation, 3 position rpm installation}
The main features of MySQL 5.7are as follows:
Native support for Systemd
Better performance: better optimization for multicore CPU, solid state drives, and locks
Better InnoDB storage engine
More robust replication: replication brings a solution that does not lose data at all, and traditional financial customers can also choose to use MySQL databases.
New sys library: this will be the most frequently accessed library by DBA in the future
Better optimizer: the meaning of optimizer code refactoring will bring huge improvements in this and later versions, and Oracle officials are solving the biggest problem before MySQL: native JSON type support (JavaScript Object Notation).
Note: JSON (JavaScript Object Notation) is a lightweight data exchange format. JSON uses a completely language-independent text format, but also uses conventions similar to the C language family (including C, C++, C #, Java, JavaScript, Perl, Python, and so on). These features make JSON an ideal data exchange language. It is easy for people to read and write, and it is also easy to be parsed and generated by machines (generally used to increase the network transmission rate).
The JSON syntax is a subset of the syntax represented by JavaScript objects.
L data in key-value pair
L data is separated by commas
L curly braces save object
L square brackets save array
L installation file preparation
L download cmake-3.5.tar.gz http://wwwNaNake.org/download/
L download ncurses-5.9.tar.gz ftp://ftp.gnu.org/gnu/ncurses/
L download bison-3.0.4.tar.gz http://ftp.gnu.org/gnu/bison/
L download mysql-5.7.13.tar.gz
L wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz
L download Boost_1_59_0.tar.gz
L wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
Installation example: (first compile and install the source code)
First install Development Tools development tools {including gcc..} through yum
Yum groupinstall "Development Tools"
Delete the mariadb database that comes with centos system to prevent conflicts
Rpm-qa | grep mariadb
Rpm-e mariadb-libs-- nodeps
2. Install the dependency package
Note: the role of related dependency packages
Cmake: since the regular configure compilation method has been deprecated from the MySQL5.5 version, a CMake compiler is required to set the compilation parameters for mysql. Such as: installation directory, data storage directory, character encoding, sorting rules and so on.
Boost # Boost library is required from MySQL 5.7.5. C++ 's Boost library is used in mysql source code, which requires boost1.59.0 or above to be installed.
GCC is a C language compilation tool under Linux. Mysql source code compilation is written entirely in C and C++. GCC is required to be installed.
C _ syntax + parser under bison:Linux
Ncurses: character terminal processing library
Install cmake tools and use mysql for subsequent installation
Tar zxvf cmake-3.5.2.tar.gz
Cd cmake-3.5.2/
. / bootstrap
Gmake & & gmake install
Cmake-version
Cd..
Tar zxvf ncurses-5.9.tar.gz
Cd ncurses-5.9/
. / configure & & make & & make install
Cd..
Tar zxvf bison-3.0.4.tar.gz
Cd bison-3.0.4/
. / configure & & make & & make install
Cd..
Tar zxvf boost_1_59_0.tar.gz
Mv boost_1_59_0 / usr/local/boost
Create users and groups for mysql
Groupadd-r mysql
Useradd-r-g mysql-s / bin/false-M mysql
Tar zxvf mysql-5.7.18.tar.gz
Cd mysql-5.7.18/
Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/usr/local/mysql/data-DSYSCONFDIR=/etc-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DEXTRA_CHARSETS=all-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DWITH_SYSTEMD=1-DWITH_BOOST=/usr/local/boost
Note 1: configuration explanation:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql [root directory of MySQL installation]-DMYSQL_DATADIR=/usr/local/mysql/data [directory where MySQL database files are stored]
-DSYSCONFDIR=/etc [directory where the MySQL configuration file is located]
-DWITH_MYISAM_STORAGE_ENGINE=1 [add MYISAM engine support]
-DWITH_INNOBASE_STORAGE_ENGINE=1 [add InnoDB engine support]
-DWITH_ARCHIVE_STORAGE_ENGINE=1 [add ARCHIVE engine support]
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock [specify mysql.sock location]
-DWITH_PARTITION_STORAGE_ENGINE=1 [installation supports database partitioning]
-DEXTRA_CHARSETS=all [enables MySQL to support all extended characters]
-DDEFAULT_CHARSET=utf8 [sets the default character set of MySQL to utf8]-DDEFAULT_COLLATION=utf8_general_ci [sets default character set alignment rules]
-DWITH-SYSTEMD=1 [systemd can be used to control mysql service]
-DWITH_BOOST=/usr/local/boost [points to the directory where the boost library is located]
More parameters execute [root@localhost mysql-5.7.13] # cmake. -LH
Make & & make install
Echo "export PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile
Source / etc/profile
Create the data storage location of the mysql database, data, and the location of the log log
Mkdir / usr/local/mysql/data-p
Mkdir / usr/local/mysql/log
Adjust the master group of mysql and the data directory to 750
Chown-R mysql:mysql / usr/local/mysql/
Chmod 750 / usr/local/mysql/data/
Initialize:
1. Have a password.
Mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data
Vim / etc/my.cnf {main configuration file of mysql database, port number, basic directory, data directory}
[mysqld]
Basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
Port=3306
Server_id=1
Socket=/usr/local/mysql/mysql.sock
Log-error=/usr/local/mysql/data/mysqld.err
Cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/ adds a mysql service as a system service
Systemctl enable mysqld starts the MySQL service
Start the service: systemct start mysqld
Failed to start to view the error log
1.
Mkdir / var/run/mysqld
Chown-R mysql:mysql / var/run/mysqld/
Systemctl start mysqld.service
Netstat-atnlp {check whether the MySQL service is started}
Mysql-uroot-p log in to the database and then change the password
Alter user 'root'@'localhost' identified by' Abc123'
Second, then install the rpm package.
For the simplest way to install the mysql-server service, you only need to install the following four software packages, which can be installed using the rpm-ivh command
Mysql-community-common-5.7.9-1.el7.x86_64.rpm
Mysql-community-libs-5.7.9-1.el7.x86_64.rpm-(dependent on common)
Mysql-community-client-5.7.9-1.el7.x86_64.rpm-(dependent on libs)
Mysql-community-server-5.7.9-1.el7.x86_64.rpm-(dependent on client, common)
The next step is to initialize the database. We can use the following commands, and the effect is the same.
Mysqld-the new version of initialize / / recommends this method. The executor will generate a random password in / var/log/mysqld.log.
Change the users and groups of the mysql database directory, and then start the mysql database
Chown mysql:mysql / var/lib/mysql-R
Systemctl start mysqld.service / / start the mysql database service
Three: binary installation mysql
First extract the tar package
Move the binaries to the / usr/local/mysql directory
Next, create mysql users and mysql groups
Then create a data directory to store mysql data and a log directory to store log files
Next, set the group and owner and grant permissions to the mysql user
Modify the / etc/my.cnf file under mysql
[client]
Port = 3306
Socket = / tmp/mysql.sock
[mysqld]
Server_id=10
Port = 3306
User = mysql
Character-set-server = utf8mb4
Default_storage_engine = innodb
Log_timestamps = SYSTEM
Socket = / tmp/mysql.sock
Basedir = / usr/local/mysql
Datadir = / usr/local/mysql/data
Pid-file = / usr/local/mysql/data/mysql.pid
Max_connections = 1000
Max_connect_errors = 1000
Table_open_cache = 1024
Max_allowed_packet = 128m
Open_files_limit = 65535
# = [innodb] =
Innodb_buffer_pool_size = 1024m
Innodb_file_per_table = 1
Innodb_write_io_threads = 4
Innodb_read_io_threads = 4
Innodb_purge_threads = 2
Innodb_flush_log_at_trx_commit = 1
Innodb_log_file_size = 512m
Innodb_log_files_in_group = 2
Innodb_log_buffer_size = 16m
Innodb_max_dirty_pages_pct = 80
Innodb_lock_wait_timeout = 30
Innodb_data_file_path=ibdata1:1024M:autoextend
# = [log] =
Log_error = / usr/local/mysql/log/mysql-error.log
Slow_query_log = 1
Long_query_time = 1
Slow_query_log_file = / usr/local/mysql/log/mysql-slow.log
Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Add the mysql service to the environment variable of the system, so that you don't have to use the absolute path when you use the mysql service later.
Initialize mysql: initialize mysqld in a directory
Bin/mysqld-initialize-user=mysql
Add services, start
Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld
Service mysqld start
Next, look at the key in the / usr/local/mysql/log/mysql-err.log log
Log in to the mysql database
Four: use script to install mysql
Run the script
The service has been started successfully
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.