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

Case Analysis of installing mysql5.7.16 Database in Centos7

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "Centos7 installation mysql5.7.16 database instance analysis". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Version: mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar

Note: you need to determine whether this system has mysql before installation, and if so, you must uninstall it (the mariadb database comes with centos7, so the first step is to uninstall the database)

View the mysql database:

Rpm-qa | grep-I mysql

Uninstall the mysql database:

Rpm-e [mysql file name]

If there is an associated file, you cannot uninstall it directly. You can use the command to force uninstall

Rpm-e-nodeps [mysql file name]

Copy mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar to / home/ (when you install software under linux, you usually need to copy files to the home directory)

Cp mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar / home/

2. Decompress the files

Tar-xvf mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar

Here are all the extracted rpm files

Extract and install the rpm file

1. Generally speaking, you only need to install the following files

two。 Next, extract the rpm files one by one with the command and install them.

Note: here is a detail to pay attention to, the above files are also in order in the installation, it has the corresponding priority. So you need to unpack and install one by one in the following order

Mysql-community-common-5.7.16-1.el7.x86_64mysql-community-libs-5.7.16-1.el7.x86_64mysql-community-client-5.7.16-1.el7.x86_64mysql-community-server-5.7.16-1.el7.x86_64mysql-community-devel-5.7.16-1.el7.x86_64

4. After the installation is successful, start the mysql service

Systemctl start mysqld.service

5. Check whether port 3306 is open

Netstat-ln | grep 3306

VI. Modify the my.cnf configuration file

1. This step requires finding the my.cnf file. The default path of the my.cnf file is / etc/my.cnf

two。 Edit my.cnf

Vim / etc/my.cnf

3. After entering insert mode, press'ifold 'and insert the following code

[mysqld] datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.socksymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidvalidate_password=offdefault-storage-engine=innodbcharacter-set-server=utf8collation-server=utf8_general_ci

Note: validate_password=off means to close the password authentication plug-in (this sentence must be added, because it will be very troublesome if you don't add it when changing the password).

4. Save and exit (after pressing 'esc', after entering': wq')

5 restart the mysql service

Systemctl restart mysqld.service

Seventh, when it comes to this step, it is particularly important that every step in front of you must be carefully tested and successfully implemented.

1. Initialization table

/ user/sbin/mysqld-initialize-user=mysql

two。 After initialization, a 00:00 login password for mysql is generated, so where can I check it? The log path configured previously in the my.cnf file is log-error=/var/log/mysqld.log. Check the mysqld.log log under this path and find the 00:00 password

Cat / var/log/mysqld.log | grep password

3. Change the password of the mysql database according to the 00:00 password

Mysql_secure_installation

4. When you enter, he will ask you to enter your password, so you only need to enter the 00:00 password.

5. Enter the correct enter, then enter the new password, and then confirm.

After the password has been changed, you can log in to mysql.

This is the end of the content of "Centos7 installation mysql5.7.16 database instance analysis". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report