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

Linux Learning part 3 Centos7 installation of mysql5.7.16 Database

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Installing mysql under linux is not as easy as under windows, but it is not very difficult. This article shows you how to install the mysql5.7 version under Centos7. If there are any problems and errors, you are welcome to point out.

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.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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