How to solve the initialization error of mysql5.7 installed in the rpm package in centos6.5, centos6.5mysql5.7

Source: Internet
Author: User

How to solve the initialization error of mysql5.7 installed in the rpm package in centos6.5, centos6.5mysql5.7

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.rpmrpm -ivh mysql-community-libs-5.7.19-1.el6.i686.rpm rpm -ivh mysql-community-libs-compat-5.7.19-1.el6.i686.rpmrpm -ivh mysql-community-client-5.7.19-1.el6.i686.rpmrpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpm

Note: If the installation is not completely new, but is previously installed with rpm, not installed, and uninstalled, the following may occur:

In executionrpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpmIf the following output is displayed:

It may be because the data directory is not cleared. Let's perform manual initialization 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

If an error is reported, Baidu finds the error information and finds that the data directory needs to be cleared:

From the official documents, we can see the data directory location:

Then try clearing it.

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

Next, initialize:

mysqld --initialize --user=mysql

Start mysql:

[root@mini2 upload]# service mysqld start 

Starting mysqld: [OK]
 

3. Search for the initial password (I have two passwords here, which should be because they have not been uninstalled, and the new password should be used to log on)

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

4. log on

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

My logon is OK. The password uses Adgwggdr % 1e2.

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

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

Summary

The above section describes how to solve the initialization error of mysql5.7 installed in the rpm package in centos. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.