Get the App
SLTechnology News&Howtos  ›  Servers  › 

Analysis of the process of installing mysql 5.7binary system

Shulou Source: shulou.com Published: 2022-06-03 06:38:38 09月21日 Update

The following mainly brings you to install mysql 5.7binary process analysis, I hope these words can bring you practical use, this is also my main purpose of editing this article. All right, don't talk too much nonsense, let's just read the following.

1 download mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz on the official website

2 you can check the Mysql or mariadb in the system first, and uninstall it if it exists

[root@bogon ~] # rpm-qa | grep mysql

Php-mysql-5.4.16-46.1.el7_7.x86_64

[root@bogon ~] # rpm-qa | grep mariadb

Mariadb-libs-5.5.64-1.el7.x86_64

Mariadb-server-5.5.64-1.el7.x86_64

Mariadb-5.5.64-1.el7.x86_64

[root@bogon] # yum-y remove php-mysql-5.4.16-46.1.el7_7.x86_64

Loaded plugins: fastestmirror

Resolving Dependencies

-> Running transaction check

-> Package php-mysql.x86_64 0RU 5.4.16-46.1.el7_7 will be erased

-> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size

3 useradd-M-s / sbin/nologin-r mysql / /-M does not create a home directory,-s / sbin/nologin does not allow login, and-r creates a system user

4 tar zxf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz-C / usr/local/ decompress

5 cd / usr/local/

Mv mysql-5.7.26-linux-glibc2.12-x86_64/ mysql

Cd mysql

Mkdir data / / create a data directory

Chown-R mysql.mysql / usr/local/mysql/

Bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data

/ / display the random password for the first login of root@localhost. Note the password here. The password file grep "temporary password" / var/log/mysqld.log

6 [root@bogon mysql] # vi / etc/my.cnf

[mysqld]

Basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

Port=3306

Socket=/usr/local/mysql/mysql.sock

Character-set-server=utf8

Log-error=/var/log/mysqld.log

Pid-file=/tmp/mysqld.pid

[mysql]

Socket=/usr/local/mysql/mysql.sock

[client]

Socket=/usr/local/mysql/mysql.sock

7 configuration of environment variables

[root@bogon mysql] # vi / etc/profile.d/mysql.sh

Export PATH=/usr/local/mysql/bin:$PATH

[root@bogon mysql] # source / etc/profile.d/mysql.sh

8 cp support-files/mysql.server / etc/init.d/mysqld

Vim / etc/init.d/mysqld

Basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

Chmod + x / etc/init.d/mysqld

9 [root@bogon mysql] # / etc/init.d/mysqld stop

Shutting down MySQL.. SUCCESS!

[root@bogon mysql] #

Mysql

Mysql-uroot-paire >; Yl?WVp7Na'

As I had just finished the above steps, the computer could not operate remotely at this time, the terminal was lost, and the password was naturally gone, so I deleted the kong empty var/log/mysqld.log log file to enter the safe mode.

Cd / usr/local/mysql/bin

. / mysqld_safe-- skip-grant-tables & in this mode, after MySQL logs in

Perform the initialization of step 5 here and find the password

Grep "temporary password" / var/log/mysqld.log

Change the password after restarting MySQL and entering normal mode.

Mysql > set password for root@localhost=password ('123456')

Mysql > show variables like 'validate_password%'; to see if the password is a complex policy

Empty set (0.00 sec)

Mysql > set password=password ('1234567')

Query OK, 0 rows affected, 1 warning (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Master-slave replication based on binary system

Master: / etc/my.cnf add:

Server-id=1

Log-bin=mysql-bin

Show variables like 'log_bin'

Show master status

CREATE USER 'repl'@'%.mydomain.com' IDENTIFIED BY' slavepass'

GRANT REPLICATION SLAVE ON. TO 'repl'@'%.mydomain.com'

Slave:

Vim / etc/my.cnf is added as follows

Server-id = 2

Slop slave

Change master to

-> > master_host='192.168.137.2'

-> master_user='repl'

-> master_password='slavepass'

-> master_password='mysql-bin.0000002'

-> master_log_pos=319

Start slave

Show slave status

Check whether the io/sql thread is YES. If the status is wrong, look at the error log.

For the above about the installation of mysql 5.7binary process analysis, we do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Tags: Password binary mode login process following text content file log directory system wrong complex security master-slave variable actual nonsense data text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Huawei NVidia Shulou Tech Info