Environment:
CentOS 7.4 64-bit
MySQL version, 5.5.58 glibc 64-bit version,: https://dev.mysql.com/downloads/mysql/5.5.html#downloads
Create a system user for MySQL
Groupadd Mysqluseradd " /bin/bash " -b/home/mysql-d/home/mysql MySQL
Modify the password for the MySQL system user
passwd MySQL
Unzip the downloaded tar package into the/OPT directory
tar -zxvf mysql-5.5. -LINUX-GLIBC2. -x86_64. tar. Gz-c/opt
Modify the permissions of the MySQL software
chown mysql:mysql-r/opt/mysql-5.5. -LINUX-GLIBC2. -x86_64
Modify the/ETC/MY.CNF profile (due to the fact that the MARIADB is already configured by default in the CentOS 7.4 release, you can back up the original file before modifying the configuration file)
[Mysql]default-character-set =Utf8[mysqld]skip-name-Resolveport=3306Basedir=/opt/mysql-5.5. --LINUX-GLIBC2. A-X86_64datadir=/opt/mysql-5.5. --LINUX-GLIBC2. A-x86_64/Datasocket=/tmp/mysql.sockmax_connections= $character-set-server =Utf8default-storage-engine =Innodblower_case_table_names=1Max_allowed_packet=16Mlog-bin =/opt/mysql-5.5. --LINUX-GLIBC2. A-x86_64/binlog/Replicalogserver-ID=1Binlog_format=Row[mysqld_safe]log-error =/opt/mysql-5.5. --LINUX-GLIBC2. A-x86_64/log/Mysql.logpid-file=/opt/mysql-5.5. --LINUX-GLIBC2. A-x86_64/log/mysql.pid
It is necessary to describe several parameters here.
The Log-bin parameter is a parameter that sets the MySQL transaction log archive directory when it is explicitly set, and a number of archived transaction log files will be generated in the specified directory in the future, and an index file named Binlog.index will be generated
The Binlog_foramt parameter is the format of the specified archived transaction log because the author's MySQL service will be deployed as the source of OGG in the future, so the archive transaction log must be set to row
Switching MySQL system users
su -/opt/mysql-5.5. -LINUX-GLIBC2. -x86_64
Create a new directory using a MySQL system user
Mkdir-p/opt/mysql-5.5.58-linux-glibc2.12-x86_64/binlogmkdir-p/opt/mysql-5.5.58-linux-glibc2.12-x86_64/ Logmkdir-p/opt/mysql-5.5.58-linux-glibc2.12-x86_64/data
Initializing MySQL-related data files
scripts/mysql_install_db--user=mysql--basedir=/opt/mysql-5.5. -LINUX-GLIBC2. -x86_64--datadir=/opt/mysql-5.5. -LINUX-GLIBC2. -x86_64/data
Start the MySQL service using safe mode, after which the console stops and requires the user to continue working in another shell window
Bin/mysqld_safe--user=mysql--skip-grant-tables--skip-networking--basedir=/opt/mysql-5.5. -LINUX-GLIBC2. -x86_64--datadir=/opt/mysql-5.5. -LINUX-GLIBC2. -x86_64/data
Proceed to the MySQL Shell console and set the root user's password
Bin/mysql-urootmysql> Update mysql.user set Authentication_string=password ('mysql ') where user='root';
In the shell PS find the MySQL service that just started, and then stop it
kill - $ (PS -ef | grep"mysqld--basedir"grepgrepawk '{print $}')
Subsequent operations continue with the root system user
Copy the service script from MySQL to the/ETC/INIT.D directory
CP /opt/mysql-5.5. -LINUX-GLIBC2. -x86_64/support-files/mysql.server/etc/init.d/
Start the MySQL service with the root user
Service mysqld Start
- View the status of the MySQL service
Service MYSQLD Status
- Commands to stop the MySQL service
Service Mysqld Stop
Under the MySQL service startup state, go to the MySQL Shell console and set the root password again
Bin/mysql-urootmysql> Set password= password ('mysql');
This makes the deployment of the MySQL service basically complete.
MySQL 5.5.58 tar package installation Deployment