Solution to the initialization error when installing mysql5.7 from rpm package in centos6.5

Solution to the initialization error when installing mysql5.7 from rpm package in centos6.5

1. Upload rz to the server and decompress it

rz
[root@mini2 upload]# tar -xvf mysql-5.7.19-1.el6.i686.rpm-bundle.tar

2. Install the rpm package

rpm -ivh mysql-community-common-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el6.i686.rpm 
rpm -ivh mysql-community-libs-compat-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-client-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpm

Note: If it is not a new installation, but was previously installed using rpm, but was not installed properly and then uninstalled, the following situations may occur:

When executing rpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpm , if the following output appears:

There is a high possibility that the data directory is not cleared. Let's try manually initializing it and execute the following command:

[root@mini2 upload]# mysqld --initialize --user=mysql  
2017-08-29T05:22:18.750237Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-29T05:22:18.754943Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2017-08-29T05:22:18.755064Z 0 [ERROR] Aborting

I found an error message, and searched Baidu for it. I found that I needed to clear the data directory:

From the official documentation, the data directory location is:

Then clear it and try again.

[root@mini2 upload]# rm -rf /var/lib/mysql/*

Next, initialize:

mysqld --initialize --user=mysql

Next, start mysql:

[root@mini2 upload]# service mysqld start

Starting mysqld: [ OK ]

3. Find the initial password (the reason why I have two passwords here is probably because I didn’t uninstall it completely before, so I intuitively think I should use the new password later to log in)

[root@mini2 upload]# grep 'temporary password' /var/log/mysqld.log
2017-08-29T05:00:02.613275Z 1 [Note] A temporary password is generated for root@localhost: tzqjMvkHH3+C
2017-08-29T05:31:51.340338Z 1 [Note] A temporary password is generated for root@localhost: Adgwggdr%1e2

4. Login

[root@mini2 upload]# mysql -uroot -p

I logged in ok, the password is Adgwggdr%1e2

5. Change the password and allow clients on other machines to log in

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option

Summarize

The above is the solution to the initialization error of mysql5.7 installed with rpm package in centos6.5 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • CentOS7 uses rpm to install MySQL 5.7 tutorial diagram
  • Detailed tutorial on installing mysql 8.0.13 (rpm) on Centos7
  • Installation tutorial of mysql8.0rpm on centos7
  • Install MySQL 5.7.18 using rpm package under CentOS 7
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • CentOS7 uses rpm package to install mysql 5.7.18
  • Tutorial on installing MySQL 5.7.9 using RPM package under CentOS 7
  • Install mysql5.7.13 using RPM in CentOS 7
  • CentOS7 detailed installation of MySQL using rpm
  • Brief analysis of centos 7 mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

<<:  How to use CocosCreator for sound processing in game development

>>:  How to add custom system services to CentOS7 systemd

Recommend

Detailed explanation of how to enable slow query log in MySQL database

The database enables slow query logs Modify the c...

Web Design Help: Web Font Size Data Reference

<br />The content is reproduced from the Int...

mysql indexof function usage instructions

As shown below: LOCATE(substr,str) Returns the fi...

React-Native environment setup and basic introduction

Environment Preparation 1. Environment Constructi...

jQuery implements sliding tab

This article example shares the specific code of ...

Detailed tutorial on installation and configuration of MySql 5.7.17 winx64

1. Download the software 1. Go to the MySQL offic...

Vue implements graphic verification code

This article example shares the specific code of ...

Steps to install cuda10.1 on Ubuntu 20.04 (graphic tutorial)

Pre-installation preparation The main purpose of ...

MySQL 5.7.24 installation and configuration graphic tutorial

This article shares the installation and configur...

Implementation of mysql data type conversion

1. Problem There is a table as shown below, we ne...

How to use react-color to implement the front-end color picker

background We can use react-color to implement th...

How to recover files accidentally deleted by rm in Linux environment

Table of contents Preface Is there any hope after...