mysql-5.7.28 installation tutorial in Linux

mysql-5.7.28 installation tutorial in Linux

1. Download the Linux version from the official website: https://dev.mysql.com/downloads/mysql/5.7.html

insert image description here

2. Upload the tarball to the server to /usr/local/src

3. Uninstall the system's automatic Mariadb rpm -qa | grep mariadb rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64

insert image description here

4. Check if mysql exists

rpm -qa|grep -i mysql

5. Check if there is still a mysql directory find / -name mysql

insert image description here

6. Unzip: tar -zxvf

insert image description here

7. Change the name: mv mysql-5.7.28-linux-glibc2.12-x86_64/mysql-5.7.28

8. Check if the mysql group and user exist, if not create them

cat /etc/group | grep mysql
cat /etc/passwd | grep mysql

Create a mysql group and create a mysql user to join the mysql group

groupadd mysql
useradd -g mysql mysql
passwd mysql #Set password 

insert image description here

8. Change the group and user

[root@localhost src]# chown -R mysql mysql-5.7.28/
[root@localhost src]# chgrp -R mysql mysql-5.7.28/ 

insert image description here

9. Create data

insert image description here

10. Delete my.cnf under etc: rm -rf /etc/my.cnf; create my.cnf

[mysql]
# Set the default character set of the mysql client to default-character-set=utf8 
[mysqld]
skip-name-resolve
#Set port 3306 port = 3306 
# Set the installation directory of mysql to basedir=/usr/local/src/mysql-5.7.28
# Set the storage directory of mysql database data datadir=/usr/local/src/mysql-5.7.28/data
# Maximum number of connections allowed max_connections=200
# The default character set used by the server is the 8-bit latin1 character set character-set-server=utf8
# The default storage engine that will be used when creating a new table default-storage-engine=INNODB 
lower_case_table_names=1
max_allowed_packet=16M

11.Installation initialization: bin/mysql_install_db --user=mysql --basedir=/usr/local/src/mysql-5.7.28/ --datadir=/usr/local/src/mysql-5.7.28/data/

insert image description here

12. Re-modify the permissions of each directory

[root@localhost mysql-5.7.28]# chown -R root:root /usr/local/src/mysql-5.7.28/
[root@localhost mysql-5.7.28]# chown -R mysql:mysql /usr/local/src/mysql-5.7.28/data/

Start mysql

/usr/local/src/mysql-5.7.28/bin/mysqld_safe --user=mysql &

13. [root@localhost bin]# ./mysql -u root -p # If there is no password by default, just press Enter

14. If you don’t remember the password, vi /etc/my.cnf and add: skip-grant-tables Save and exit (:wq)

15. Restart mysql: service mysqld restart , then ./mysql -u root -p and press Enter

16. Change password: update user set authentication_string=password('123456) where user='root';

flush privileges;
quit; 

insert image description here

18. Modify my.cnf again: vi /etc/my.cnf Delete the skip-grant-tables just added, save and exit (:wq)

19. Restart mysql: service mysqld restart; ./mysql mysql -u root -p to enter

insert image description here

20. If this occurs

insert image description here

systemctl stop firewalld.service #Shut down the firewall servicesystemctl disable firewalld.service #Disable the firewall to start firewall-cmd --state #Check the firewall statusservice mysqld restart

21. Modification Permissions

use mysql;
grant all privileges on *.* to root@"%" identified by "123456";

22. If an error occurs

insert image description here

SET PASSWORD = PASSWORD('123456'); 

insert image description here

23. Connection successful

insert image description here

Summarize

The above is the installation tutorial of MySQL 5.7.28 under Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed steps and problem solving methods for installing MySQL 8.0.19 on Linux
  • Linux system MySQL8.0.19 quick installation and configuration tutorial diagram
  • Tutorial diagram of installing mysql8.0.18 under linux (Centos7)
  • MySQL 8.0.18 installation and configuration method graphic tutorial (linux)
  • Detailed tutorial on installing MySQL database in Linux environment

<<:  Detailed explanation of several commands in Linux to obtain detailed hardware information

>>:  jQuery implements all selection and reverse selection operation case

Recommend

Summary of practical skills commonly used in Vue projects

Table of contents Preface 1. Use $attrs and $list...

Detailed explanation of Vue form binding and components

Table of contents 1. What is two-way data binding...

Introduction to the use and disabling of transparent huge pages in Linux

introduction As computing needs continue to grow,...

How to deploy Tencent Cloud Server from scratch

Since this is my first post, if there are any mis...

Several ways of running in the background of Linux (summary)

1. nohup Run the program in a way that ignores th...

Three uses and differences of MySQL not equal

Judgment symbols are often used in MySQL, and not...

How to open a page in an iframe

Solution: Just set the link's target attribute...

User experience of portal website redesign

<br />From the launch of NetEase's new h...

Web lesson plans, lesson plans for beginners

Teaching Topics Web page Applicable grade Second ...

JS cross-domain solution react configuration reverse proxy

Cross-domain solutions jsonp (simulate get) CORS ...

Summary of using the reduce() method in JS

Table of contents 1. Grammar 2. Examples 3. Other...

Using JS to implement binary tree traversal algorithm example code

Table of contents Preface 1. Binary Tree 1.1. Tra...

How to import Excel files into MySQL database

This article shares with you how to import Excel ...