Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql 5.7How to perform binary normal installation

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to install mysql 5.7. the article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

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.

The above is the editor for you to share the mysql 5.7 how to carry out the binary ordinary installation, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report