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

A brief talk about React Router's history

If you want to understand React Router, you shoul...

Superficial Web Design

<br />I have always believed that Yahoo'...

Use pure CSS to achieve switch effect

First is the idea We use the <input type="...

Div adaptive height automatically fills the remaining height

Scenario 1: Html: <div class="outer"...

25 fresh useful icon sets for download abroad

1. E-Commerce Icons 2. Icon Sweets 2 3. Mobile Ph...

Example of cross-database query in MySQL

Preface In MySQL, cross-database queries are main...

How to reset the root password of Mysql in Windows if you forget it

My machine environment: Windows 2008 R2 MySQL 5.6...

Troubleshooting the reasons why MySQL deleted records do not take effect

A record of an online MySQL transaction problem L...

HTML table cross-row and cross-column operations (rowspan, colspan)

Generally, the colspan attribute of the <td>...

Detailed explanation of Angular parent-child component communication

Table of contents Overview 1. Overview of input a...

Example of writing mobile H5 to invoke APP (IOS, Android)

iOS 1. URL scheme This solution is basically for ...