In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to install MySQL under CentOS7". In daily operation, I believe many people have doubts about how to install MySQL under CentOS7. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to install MySQL under CentOS7". Next, please follow the editor to study!
Situation description
Due to the need of work, it is necessary to install MySQL on a test server with CentOS system. Because other important test data are stored on the server, it can not be connected to the external network. Since the installation of MySQL has always been done with one click of the yum command, it is a bit troublesome to install it manually. So here I will record some of the problems I encountered during the installation process.
Before I start, I have to complain that there are some tutorials on the Internet that are really ridiculous. The tutorials directly copy and paste others', do not write the environment, and have no version number description. It makes me angry.
The MySQL installed in this article is to install the most basic functions. If you need to install other additional features, please refer to the official documentation.
This article is suitable for the installation operation when the server can not be connected to the Internet.
Installation
Environment description
Here are some of the environmental instructions I used when writing this article.
I haven't tested for other versions of the environment, so there's no guarantee of success, but there should be no big difference between minor version numbers.
Project version description operating system CentOS 7.2.1511 x86x64 minimize installation of MySQLCommunity 5.7.18-1.el7.x8664rpm package
Note: you can use the cat / etc/redhat-release command to determine the specific version of the CentOS you installed.
Preparatory work
To download the installation package of MySQL, it is recommended to use Sohu's mirror station to download it, because the download speed from the MySQL official website is really touching. You can download it by selecting the corresponding version number at the image address. There are four rpm packages I use here:
Mysql-community-client-5.7.18-1.el7.x86_64.rpm
Mysql-community-common-5.7.18-1.el7.x86_64.rpm
Mysql-community-libs-5.7.18-1.el7.x86_64.rpm
Mysql-community-server-5.7.18-1.el7.x86_64.rpm
The above four rpm packages are required. If you need other features, you can download them yourself. Taking the current version as an example, the file containing all the rpm packages is mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
Download the numactl package:
Numactl-2.0.9-6.el7_2.x86_64.rpm
Numactl-devel-2.0.9-6.el7_2.x86_64.rpm
Numactl-libs-2.0.9-6.el7_2.x86_64.rpm
Download other related support:
Perl-Data-Dumper-2.145-3.el7.x86_64.rpm
Libaio-0.3.109-13.el7.x86_64.rpm
The above software packages will be used later, please prepare them in advance. This software package can be downloaded by searching directly on the Internet. A download address is provided here. The download address can be searched directly in the search box. When downloading, pay attention to the version number and number of digits (64 bits).
Upload the downloaded software package to the server and prepare for installation.
Installation
The following is just my installation order, in fact, there are not many clear requirements for the installation order of these software packages, it is not necessary to install them in the following order, but there can be some related dependency problems, if you throw dependency-related errors, just retry the corresponding dependency installation above.
Install libaio-0.3.109-13.el7.x86_64.rpm
Rpm-ivh libaio-0.3.109-13.el7.x86_64.rpm
Install perl-Data-Dumper-2.145-3.el7.x86_64.rpm
Rpm-ivh perl-Data-Dumper-2.145-3.el7.x86_64.rpm
I did not encounter the dependency problem during the above two installations. if you encounter it during the actual installation, please check the relevant prompts and install the corresponding package when downloading.
Installation of numactl related
Rpm-ivh numactl*
If we do not install this package, we will get the following error
Error: Failed dependencies: libnuma.so.1 () (64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64 libnuma.so.1 (libnuma_1.1) (64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64 libnuma.so.1 (libnuma_1.2) (64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64
If we install mysql directly at this time, we will get an exception:
Warning: mysql-community-libs-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-common (x86-64) > = 5.7.9 is needed by mysql-community-libs-5.7.18-1.el7.x86_64 mariadb-libs is obsoleted by mysql-community-libs-5.7.18-1.el7.x86_64
* the line can also see that it is the problem of dependency. What the heck is the "mariadb-libs abandoned" in the second line? Why don't you provide a new one when it's abandoned? After some search, it was found that it was because there was already a mariadb on CentOS 7 that would conflict with MySQL's mariadb. So at this point, we need to uninstall the mariadb that comes with the system, and then use the mariadb that comes with mysql.
Let's first check the installed version of the system, rpm-qa | grep mariadb, and then uninstall it. During the uninstall process, you will be prompted not to uninstall, because other software depends on this package, and we need to add the-- nodeps parameter to force the uninstall.
Rpm-e-- nodeps mariadb-libs-5.5.37-1.el7_0.x86_64
Notice that the mariadb-libs-5.5.37-1.el7_0.x86_64 I wrote above is the result I just queried with rpm-qa | grep mariadb. Different versions may be different.
Once this problem is resolved, you can install mysql, rpm-ivh mysql-community-*.
Start
Start the mysql instance with the service mysqld start command, and to verify it, let's use service mysqld status to verify it. The output is as follows:
Redirecting to / bin/systemctl status mysqld.service ● mysqld.service-MySQL ServerLoaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2017-07-03 15:39:02 CST 5s agoDocs: man:mysqld (8) http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 28054 ExecStart=/usr/sbin/mysqld-- daemonize-- pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 27978 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited Status=0/SUCCESS) Main PID: 28056 (mysqld) CGroup: / system.slice/mysqld.service └─ 28056 / usr/sbin/mysqld-daemonize-pid-file=/var/run/mysqld/mysqld.pidJul 03 15:38:57 nodemaster systemd [1]: Starting MySQL Server...Jul 03 15:39:02 nodemaster systemd [1]: Started MySQL Server.
Log in
When we use mysql-u root, we will be prompted for a password, which is stored in the / var/log/mysqld.log file and is automatically generated by the system. We can use the command cat / var/log/mysqld.log | grep password to find out the password, enter it, log in, change the password after login, and so on. These operations are described in detail in the official documentation and can be checked by yourself.
At this point, the study on "how to install MySQL under CentOS7" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.