Get the App
SLTechnology News&Howtos  ›  Database  › 

How to install mysql-5.7.28 under Linux

Shulou Source: shulou.com Published: 2022-05-31 21:58:40 09月29日 Update

This article is about how to install mysql-5.7.28 under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

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

two。 Upload tar package to server to / usr/local/src

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

4. Check to see if mysql exists

Rpm-qa | grep-I mysql

5. Query whether there is still a directory of mysql find /-name mysql

6. Decompress: tar-zxvf

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

8. Check whether mysql groups and users exist, if not created

Cat / etc/group | grep mysqlcat / etc/passwd | grep mysql

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

Groupadd mysqluseradd-g mysql mysqlpasswd mysql # set password

8. Change the groups and users to which you belong

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

9. Create data

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

[mysql] # set mysql client default character set default-character-set=utf8 [mysqld] skip-name-resolve# setting 3306 port port = 3306 # set mysql installation directory basedir=/usr/local/src/mysql-5.7.28# set mysql database data storage directory datadir=/usr/local/src/mysql-5.7.28/data# allows maximum number of connections character set default used by max_connections=200# server Consider the default storage engine default-storage-engine=INNODB lower_case_table_names=1max_allowed_packet=16M that the 8-bit encoded latin1 character set character-set-server=utf8# will use when creating new tables

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/

twelve。 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, you can simply press enter.

14. If you don't remember the password, vi / etc/my.cnf is increasing: skip-grant-tables saves and exits (: wq)

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

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

Flush privileges;quit

18. Modify my.cnf:vi / etc/my.cnf again to delete and save the newly added:: skip-grant-tables and exit (: wq)

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

20. If this happens,

Systemctl stop firewalld.service # disable firewall service systemctl disable firewalld.service # disable firewall enable start firewall-cmd-- state # check firewall status service mysqld restart

21. Modify permissions

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

twenty-two。 If an error occurs

SET PASSWORD = PASSWORD ('123456')

23. Connected successfully

Thank you for reading! This is the end of the article on "how to install mysql-5.7.28 under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Password directory character character set user firewall service check fire protection content data more permissions article good practical maximum successful again name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Xiaomi OPPO Reno Docker Shulou Technology