In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following brings you the successful installation of MySQL 5.7.13 steps related to the content, I believe you must have read similar articles. What's the difference in what we bring to you? Let's take a look at the body part of it, I believe that after reading the successful installation of MySQL 5.7.13 steps you will certainly have something to gain.
Install MySQL 5.7.13
I. Introduction:
MySQL 5.7 features:
1. Native support for Systemd
2. Better performance: better optimization for multi-core CPU, solid state drive and lock
Better lnnoDB storage engine
4. More robust replication function: replication brings a solution without data loss at all. Traditional financial customers can also choose to use MySQL database.
MySQL-5.6.3 and above versions have supported multithreaded master-slave replication
6. New sys library: This will be the most trivial library for DBA access in the future
Install MySQL 5.7.13
System environment: Centos 7.2x86_64
1. Preparation before installation:
Centos 7.2 installed mariadb-libs by default, so uninstall it first.
[root@localhost ~]# rpm -aq | grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
[root@localhost ~]# rpm -e mariadb-libs --nodeps
2. Install dependent packages
Prepare the following installation packages
bison-3.0.4.tar.gz cmake-3.5.2.tar.gz mysql-5.7.13.tar.gz
boost_1_59_0.tar.gz ncurses-5.9.tar.gz
Note: The role of dependent packages
# cmake: Since MySQL 5.5 deprecates the regular configure compilation method, you need the cmake compiler to set mysql compilation parameters. (e.g. installation directory, data storage directory, character coding, sorting rules, etc.)
# boost: Boost library is required since MySQL 5.7.5, mysql source code uses C++ Boost library, requires Boost1.59.0 or above to be installed.
# GCC: This is a C language compiler tool under Linux. MySQL source code compilation is completely written in C and C++. GCC must be installed.
# bison: C/C++ parser for Linux.
# ncurses: Character terminal processing library.
1) Install cmake
[root@localhost ~]# tar zxf cmake-3.5.2.tar.gz
[root@localhost ~]# cd cmake-3.5.2/
[root@localhost cmake-3.5.2]# ./ bootstrap
[root@localhost cmake-3.5.2]# gmake && gmake install
2) Check the cmake version:
3) Install ncurses
[root@localhost ~]# tar zxf ncurses-5.9.tar.gz
[root@localhost ~]# cd ncurses-5.9/
[root@localhost ncurses-5.9]# ./ configure && make && make install
4) Install bison
[root@localhost ~]# tar zxf bison-3.0.4.tar.gz
[root@localhost ~]# cd bison-3.0.4/
[root@localhost bison-3.0.4]# ./ configure && make && make install
5) Install Boost
[root@localhost ~]# tar zxf boost_1_59_0.tar.gz
[root@localhost ~]# mv boost_1_59_0 /usr/local/boost
6) Create mysql users and user groups and directories
[root@localhost ~]# groupadd -r mysql
[root@localhost ~]# useradd -r -g mysql -s /bin/false -M mysql
[root@localhost ~]# mkdir -p /usr/local/mysql/data
3. Compile and install MySQL
Unzip mysql source package
[root@localhost ~]# tar zxf mysql-5.7.13.tar.gz
[root@localhost ~]# cd mysql-5.7.13/
Execute the cmake command for pre-compile configuration
[root@localhost mysql-5.7.13]# 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
: Configuration explanation:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql ## MySQL installation root
-DMYSQL_DATADIR=/usr/local/mysql/data ## MySQL database file directory
-DSYSCONFDIR=/etc ## MySQL configuration file directory
-DDEFAULT_CHARSET=utf8 ##Set Mysql default character set to utf-8
-DDEFAULT_COLLATION=utf8_general_ci ##Set default character set collation rules
-DEXTRA_CHARSETS=all ##Make MySQL support all extended characters
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock ##Specify mysql.sock location
-DWITH_MYISAM_STORAGE_ENGINE=1 ##Add MYISAM engine support
-DWITH_INNOBASE_STORAGE_ENGINE=1 ##Add lnnoDB engine support
-DWITH_ARCHIVE_STORAGE_ENGINE=1 ##Add ARCHIVE engine support
-DWITH_PARTITION_STORAGE_ENGINE=1 ##Installation Support Database Partitions
-DWITH_SYSTEMD=1 ##You can control mysql services using systemd
-DWITH_BOOST=/usr/local/boost ##Pointing to the directory where the boost library is located
Start compiling and compiling installation
[root@localhost mysql-5.7.13]# make && make install
: Ways to speed up compilation:
[root@localhost mysql-5.7.13]# make -j $(grep processor /proc/cpuinfo |wc -l) && make install
-j: parameter indicates the number of threads specified at compilation time according to CPU core number, which can speed up compilation (default is 1 thread number)
: To rerun the cmake configuration, you need to delete the CMakeCache.txt file:
[root@localhost mysql-5.7.13]# make clean
[root@localhost mysql-5.7.13]# rm -f CMakeCache.txt
Optimize MySQL execution path
[root@localhost mysql-5.7.13]# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@localhost mysql-5.7.13]# source /etc/profile
4. Set permissions and initialize MySQL system authorization table
[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# chown -R mysql:mysql .
[root@localhost mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local --datadir=/usr/local/mysql/data
: When initializing the operating system as root, add the--user=mysql parameter to generate a random password. (Remember to use it when logging in)
5. Create a configuration file
[root@localhost mysql]# cd support-files/
[root@localhost support-files]# cp my-default.cnf /etc/my.cnf
[root@localhost ~]# vim /etc/my.cnf ##Add the following under [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
6. Configure mysql to start automatically
[root@localhost ~]# cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
: Because mysqld.service assigns the default pid file to the/var/run/mysqld directory without creating a directory beforehand, starting mysql at this time will fail. Two solutions:
The first method: create the directory/var/run/mysqld and set the owner to mysql
root@localhost ~]# mkdir /var/run/mysqld
[root@localhost ~]# chown -R mysql:mysql /var/run/mysqld/
The requested URL/system/system/mysqld.service was not found on this server.
[root@localhost ~]# vim /usr/lib/systemd/system/mysqld.service
[root@localhost ~]# systemctl daemon-reload
Start mysql service
[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl status mysqld.service
View port numbers
[root@localhost ~]# netstat -anpt |grep mysqld
6. Set the root password of the database administrator user
[root@localhost ~]# mysqladmin -uroot -p'=hJ? V:? 9vQ-Q' password 123.com
Note: Enter random password generated during initialization in-p option here
access to MySQL database
[root@localhost ~]# mysql -u root -p
For the above steps on successful installation of MySQL 5.7.13, do you think it is what you want? If you want to know more about it, you can continue to pay attention to our industry information section. Steps to successfully install MySQL 5.7.13
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.