In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to install Mysql 5.7.26 with source code in CentOS7.4 environment", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to install Mysql 5.7.26 with source code in CentOS7.4 environment"!
First, software installation 1. Install the necessary software depending on yum-y install gcc gcc-c++ ncurses ncurses-devel bison cmake make2, download the mysql source code package
Mkdir / software cd / softwarewget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26.tar.gz
View the download package:
[root@localhost software] # lsmysql-5.7.26.tar.gz3, decompress mysql source code package
Tar-zxvf mysql-5.7.26.tar.gz
3. Configure and compile mysql source code package
Enter the extracted directory. In order to keep the source code clean, create a new subdirectory yunxiaochong and compile it under the subdirectory.
[root@localhost software] # lsmysql-5.7.26 mysql-5.7.26.tar.gz [root@localhost software] # cd mysql-5.7.26/ [root@localhost mysql-5.7.26] # mkdir yunxiaochong [root@localhost mysql-5.7.26] # cd yunxiaochong/
Cmake configuration:
Cmake.. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DWITH_MYISAM_STORAGE_ENGINE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_MEMORY_STORAGE_ENGINE=1\-DWITH_READLINE=1\-DENABLED_LOCAL_INFILE=1\-DWITH_PARTITION_STORAGE_ENGINE=1\-DEXTRA_CHARSETS=all\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DWITH_SSL=bundled\-DDOWNLOAD_BOOST=1\-DWITH_BOOST=/tmp
Note:
If there is an error in compilation, delete the CMakeCache.txt before recompiling:
Rm-rf CMakeCache.txt
If the following prompt appears, the compilation environment has been generated successfully:
-- Configuring done
-- Generating done
Compile:
Make-j 10
Installation:
Make instal II, database installation 1, create users
one
two
Groupadd mysql
Useradd-g mysql mysql
2. Create the directory, modify the directory owner and add the environment variable mkdir-p / data/mysql/ {3306j3307} / {data,log} chown-R mysql:mysql / data/mysql/chown-R mysql:mysql / usr/local/mysql/echo 'export PATH=$PATH:/usr/local/mysql/bin' > > / etc/profilesource / etc/profile3, and create the configuration file.
3306
Vim / data/mysql/3306/my3306.cnf
The contents are as follows:
[mysqld] basedir=/usr/local/mysqldatadir=/data/mysql/3306/dataport=3306socket=/data/mysql/3306/mysql3306.sockcharacter-set-server=utf8log-error=/data/mysql/3306/log/error3306.logpid-file=/data/mysql/3306/mysqld3306.pid
3307
Vim / data/mysql/3307/my3307.cnf
The contents are as follows:
[mysqld] basedir=/usr/local/mysqldatadir=/data/mysql/3307/dataport=3307socket=/data/mysql/3307/mysql3307.sockcharacter-set-server=utf8log-error=/data/mysql/3307/log/error3307.logpid-file=/data/mysql/3307/mysqld3307.pid4, database initialization
(1) 3306
one
Mysqld-defaults-file=/data/mysql/3306/my3306.cnf-initialize-user=mysql
(2) 3307
one
Mysqld-defaults-file=/data/mysql/3307/my3307.cnf-initialize-user=mysql
5. Database startup
(1) 3306
Cd / usr/local/mysql/bin./mysqld_safe-defaults-file=/data/mysql/3306/my3306.cnf-user=mysql &
(2) 3307
Cd / usr/local/mysql/bin./mysqld_safe-- defaults-file=/data/mysql/3307/my3307.cnf-- user=mysql & 6. Get the initial password
[root@localhost bin] # less / data/mysql/3307/log/error3307.log | grep'A temporary password'
2019-07-22T02:04:41.482707Z 1 [Note] A temporary password is generated for root@localhost: Kjipuugr0:0v
Login error:
[mysql@localhost] $mysql-uroot-P3306-S / data/mysql/3307/mysql3307.sock-p
Enter password:
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
Solution:
(1) shut down the database instance first. Because you cannot log in, only kill-9 can execute the kill process.
(2) add the option skip-grant-tables in the configuration file
(3) restart the database instance
(4) password-free login:
Mysql-uroot-P3306-S / data/mysql/3306/mysql3306.sock
(5.1) modify password expiration policy:
MySQL [none] > use mysqlMySQL [mysql] > update user set password_expired='N' where user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
(5.2) change the password:
MySQL [none] > use mysqlMySQL [mysql] > update user set authentication_string = password ("Yxc@3306") where user= "root"; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
(6) restart the database instance
[mysql@localhost] $mysqladmin-uroot-S / data/mysql/3306/mysql3306.sock shutdowncd / usr/local/mysql/bin./mysqld_safe-- defaults-file=/data/mysql/3306/my3306.cnf-- user=mysql & 7, create user MySQL [(none)] > create USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY' Yxc3307';Query OK, 0 rows affected (0.00 sec) MySQL [(none)] > grant all privileges on *. * to 'root'@'%' Query OK, 0 rows affected (0.00 sec)
Description:
Password encryption rule for previous versions of MySQL8.0: mysql_native_password
MySQL8.0 password encryption rule: caching_sha2_password
8. Log in to navicat
At this point, I believe you have a deeper understanding of "how to install Mysql 5.7.26 with source code in CentOS7.4 environment". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.