Detailed explanation of Mysql5.7. 19 installation tutorial under Centos7
- 2021-09-12 02:32:39
- OfStack
1. Download
Download mysql-5. 7.19-linux-glibc2.12-x86_64. tar. gz from official website, version 5.7. 19
Download address:
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gzLinux
2. Create mysql user groups and users
l Create mysql User Group
#groupadd mysql
l creates mysql users under the mysql user group
#useradd mysql -g mysql
3. Determine the installation directory and data directory
My mysql installation directory is/data/mysql, and my data directory is/data/mysql/data.
4. Upload the installation file to the server
Put
mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
Files are placed in the/data/installfiles directory through the ftp tool.
5. Unzip 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 mysql-5. 7.19-linux-glibc2.12-x86_64 to mysql and move under/usr/local/mysql.
#mv mysql-5.7.19-linux-glibc2.12-x86_64 /data/mysql
7. Create a directory for storing data
Create the data directory under/data/mysql
#mkdir /data/mysql/data
8. Authorize mysql users
Change the mysql directory and the following files and subdirectory files to mysql
#cd /data
#chown -R mysql:mysql mysql/
Give mysql directory and files and subdirectories below 755 permissions
#chmod -R 755 mysql/
9. Compile, 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 was: root @ localhost: 3? 2YBeSg: Nte
10. Create a log file directory
mkdir -p /data/mysql/log/mariadb/
cd /data/mysql/log/mariadb/
touch mariadb.log
chmod -R 775 mariadb.log
chown -R mysql:mysql mariadb.log
chown -R mysql:mysql /data/mysql
11. Start the mysql service
/data/mysql/support-files/mysql.server start
12. Log in to msyql and enter the password (the password is the initialization password of Step 9)
#useradd mysql -g mysql
0
13. Change the password to "123456"
#useradd mysql -g mysql
1
14. Modify/etc/my. cnf file
#useradd mysql -g mysql
2
Modify the red part of the content.
Summarize