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

The method of installing mysql5.7.18 in Centos7.3

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Editor to share with you how to install Centos7.3 mysql5.7.18, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Uninstall MariaDB

CentOS7 installs MariaDB instead of MySQL by default, and MySQL-related packages have been removed from the yum server. Because MariaDB and MySQL may conflict, uninstall MariaDB first.

1. Before installing the new version of mysql, we need to uninstall the mariadb-lib that comes with the system.

[root@iZwz94qazh72gk5ewl4ei2Z home] # rpm-qa | grep-I mariadb

Mariadb-libs-5.5.52-1.el7.x86_64

[root@iZwz94qazh72gk5ewl4ei2Z home] # rpm-e-- nodeps mariadb-libs-5.5.52-1.el7.x86_64

2. Go to mysql's website to download the latest version of mysql's rpm collection package: mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar

3. Upload mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar to the linux server and extract the tar package

[root@iZwz94qazh72gk5ewl4ei2Z home] # mkdir mysql [root@iZwz94qazh72gk5ewl4ei2Z home] # tar-xf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar-C mysql [root@iZwz94qazh72gk5ewl4ei2Z home] # cd mysql [root@iZwz94qazh72gk5ewl4ei2Z mysql] # lltotal 459492When Rwkashi rkashi-1 7155 31415 23618836 Mar 20 17:40 mysql-community-client-5.7.18-1.el6.x86q64.rpmKuk RWKul-1 7155 31415 335496 Mar 20 17:40 mysql- Community-common-5.7.18-1.el6.x86q64.rpmWhat RWQM-1 7155 31415 3747352 Mar 20 17:40 mysql-community-devel-5.7.18-1.el6.x86y64.rpmMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMKAKAY, community-common-5.7.18-1.el6.x866x64.rpmMURWMURAQ-1 7155 31415 3747352 RPML 20 17:40 RPMI-1.el6.x86 39086508 Mar 20 17:40 RPMI-1.el6.x866q64.rpmMURWMART-1 7155 31415 135869292 Mar 20 17:40 mysql-community-embedded -devel-5.7.18-1.el6.x86q64.rpmWhat RwMube-1 7155 31415 2177064 Mar 20 17:40 mysql-community-libs-5.7.18-1.el6.x86y64.rpmMMMUR Mustang-1 7155 31415 1723180 Mar 20 17:40 mysql-community-libs-compat-5.7.18-1.el6.x86mm 64.rpmMutual RWMui-1 7155 31415159060212 Mar 20 17:41 mysql-community- Server-5.7.18-1.el6.x86mm 64.rpm mysql-community-test-5.7.18-1.el6.x86_64.rpm-1 7155 31415 104881084 Mar 20 17:41 RPM-1.el6.x86_64.rpm

4. Use the rpm-ivh command to install

[root@iZwz94qazh72gk5ewl4ei2Z mysql] # rpm-ivh mysql-community-common-5.7.18-1.el6.x86_64.rpmwarning: mysql-community-common-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... # # [100%] Updating / installing... 1:mysql-community-common-5.7.18-1.e## [root@iZwz94qazh72gk5ewl4ei2Z mysql] # rpm-ivh mysql-community-libs-5.7.18-1.el6.x86_64.rpmwarning: mysql-community-libs-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... # # [100%] Updating / installing... 1:mysql-community-libs-5.7.18-1.el6## [root@iZwz94qazh72gk5ewl4ei2Z mysql] # rpm-ivh mysql-community-client-5.7.18-1.el6.x86_64.rpmwarning: mysql-community-client-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... # # [100%] Updating / installing... 1:mysql-community-client-5.7.18-1.e## [root@iZwz94qazh72gk5ewl4ei2Z mysql] # rpm-ivh mysql-community-server-5.7.18-1.el6.x86_64.rpmwarning: mysql-community-server-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... # # [100%] Updating / installing... 1:mysql-community-server-5.7.18-1.e## [100%] [root@iZwz94qazh72gk5ewl4ei2Z mysql] #

The above packages have dependencies and are executed sequentially.

Install mysql using rpm installation, and the installation path is as follows:

A database directory / var/lib/mysql/b configuration file / usr/share/mysql (mysql.server commands and configuration files) c related commands / usr/bin (mysqladmin mysqldump, etc.) d startup script / etc/rc.d/init.d/ (directory of startup script file mysql) e / etc/my.conf

5. Database initialization

To ensure that the database directory is owned by the mysql login user, if your linux system is running the mysql service as root, you need to initialize it by executing the following command

[root@iZwz94qazh72gk5ewl4ei2Z mysql] # mysqld-initialize-user=mysql

If you are logging in and running as mysql, you can remove the-- user option.

In addition, if the initialize option is initialized in "secure" mode by default, a password will be generated for root users and marked as expired. After logging in, you need to set a new password.

Using the-- initialize-insecure command does not use secure mode and does not generate a password for the root user.

The one shown here, initialized by initialize, will generate a root account password. The password is in the log file, and the password in the red area is the automatically generated password.

[root@iZwz94qazh72gk5ewl4ei2Z mysql] # cat / var/log/mysqld.log2017-06-05T14:30:52.709474Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-- explicit_defaults_for_timestamp server option (see documentation for more details). 2017-06-05T14:30:55.590590Z 0 [Warning] InnoDB: New log files created, LSN=457902017-06-05T14:30:56.000269Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2017-06-05T14:30:56.109868Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 960c533e-49fb-11e7-91f2-00163e089fd2.2017-06-05T14:30:56.116186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2017-06-05T14:30:56.116777Z 1 [Note] A temporary password is generated for root@localhost:: Wu?2QQutQwj

Now start the mysql database systemctl start mysqld.service (the unique startup method of Centos7)

[root@iZwz94qazh72gk5ewl4ei2Z mysql] # systemctl start mysqld.service

You can stop, start, and restart mysql using the following two commands:

Start:

Start with service: service mysqld start

Start with the mysqld script: / etc/inint.d/mysqld start

Start with safe_mysqld: safe_mysqld&

Stop:

Start with service: service mysqld stop

Start with the mysqld script: / etc/inint.d/mysqld stop

Mysqladmin shutdown

Restart:

Start with service: service mysqld restart

Start with the mysqld script: / etc/inint.d/mysqld restart

Connect to the database

[root@iZwz94qazh72gk5ewl4ei2Z mysql] # mysql-u root-p

Enter password:

Password input:: Wu?2QQutQwj

Change the password:

Set password = password ('your password')

Set up remote access

Grant all privileges on *. * to 'root' @'% 'identified by' 123456; flush privileges

Set mysql to boot

Join the system service:

Chkconfig-add mysql

Automatically start:

Chkconfig mysql on

Query list:

Chkconfig

Description: it does not start automatically when it is not closed (off).

The above is all the contents of this article "how to install mysql5.7.18 in Centos7.3". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Database

Wechat

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

12
Report