How to install Mysql5.7.19 in Centos7, centos7mysql5.7.19
1. Download
Download mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz from the official website. The version is 5.7.19.
:
Https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gzLinux
2. Create a mysql user group and user
L create a mysql user group
#groupadd mysql
L create a mysql user under the mysql user group
#useradd mysql -g mysql
3. Confirm the installation directory and data directory.
My mysql installation directory is/data/mysql, and the data directory is/data/mysql/data.
4. Upload the installation file to the server.
Setmysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
Files are stored in the/data/installfiles directory through ftp.
5. decompress the tar.gz file/data Directory
#cd /data/installfiles#tar -xvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
6. Modify the directory name
Rename the mysql-5.7.19-linux-glibc2.12-x86_64 to mysql and move it to/usr/local/mysql.
#mv mysql-5.7.19-linux-glibc2.12-x86_64 /data/mysql
7. Create a data storage directory
Create a data directory under/data/mysql
#mkdir /data/mysql/data
8. Authorize a mysql user
Change the mysql directory and the following files and sub-directory files to mysql.
#cd /data#chown -R mysql:mysql mysql/
Grant mysql directory and the following files and subdirectories 755 Permissions
#chmod -R 755 mysql/
9. Compile and install and initialize mysql, and remember the temporary password.
#/data/mysql/bin/mysqld --initialize --user=mysql --datadir=/data/mysql/data --basedir=/data/mysql
The temporary password installed at that time is: root @ localhost: 3? 2 YBeSg: Nte
10. Create a log file directory
mkdir -p /data/mysql/log/mariadb/cd /data/mysql/log/mariadb/touch mariadb.logchmod -R 775 mariadb.logchown -R mysql:mysql mariadb.logchown -R mysql:mysql /data/mysql
11. Start the mysql Service
/data/mysql/support-files/mysql.server start
12. log on to msyql and enter the password (the password is the initialization password in step 9th)
#mysql -u root -p
13. Change the password to "123456"
msql>alter user 'root'@'localhost' identified by '123456';mysql>use mysql;msyql>update user set user.Host='%' where user.User='root';mysql>flush privileges;mysql>quit
14. Modify the/etc/my. cnf File
# instructions in http://fedoraproject.org/wiki/Systemdsocket=/tmp/mysql.sock[mysqld]datadir=/data/mysql/datasocket=/tmp/mysql.sockmax_connections=1000# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/data/mysql/log/mariadb/mariadb.logpid-file=/data/mysql/run/mariadb/mariadb.pid## include all files from the config directory#!includedir /etc/my.cnf.d
Modify the red part.
Summary
The above is a detailed explanation of the installation tutorial for Mysql5.7.19 under Centos7. I hope it will help you. If you have any questions, please leave a message and I will reply to you in time. Thank you very much for your support for the help House website!