Centos 7 Install and uninstall Mysql5.7 (compact package)

Source: Internet
Author: User
Tags compact

Today installed MySQL, encountered a lot of problems, fortunately, the last one by one solved, now recorded here, to prevent future old road re-walk ...

1. Download

Of course, to the official website, the next version of Linux, 64-bit tar.gz, OK, put a name here-"Mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz",

I am today on the official website of the "Download MySQL Community Server" page under "linux-generic (glibc 2.5) (x86, 64-bit), compressed TAR Archive", This is a compressed package

2. Switch users

First switch to the root user:

Su

then enter the password.

3. Decompression

The download is a compressed package, so use the tar command to unzip it, and then copy the extracted folder to/usr/local/, and named MySQL.

Find the directory where your zip package is located

tar -zxvf mysql-5.7. -LINUX-GLIBC2. 5-x86_64. Tar
CP mysql-5.7. -LINUX-GLIBC2. 5-x86_64/usr/local/mysql-r

Note: the "mysql-5.7" in the command above. 16-LINUX-GLIBC2. 5-x86_64 "is the folder name after I unzipped

4. Adding user groups

Add system MySQL Group and MySQL user "This step may not be required because I used the root login, but others wrote it, and I did this step, so I can't be sure, and I have no time to verify, have time to say:

Groupadd MySQL
Useradd-r-G MySQL MySQL

5. Modify the ownership of the directory

Go to MySQL Directory

Cd/usr/local/mysql

Modify the current directory owner

chown -R mysql:mysql./
chown -R root:root./

6. Installation:

./bin/mysql_install_db--user=mysql Datadir=/usr/local/mysql/data

Or
./bin/mysql_install_db--user=mysql--defaults-file=/etc/my.cnf Datadir=/usr/local/mysql/data

This section below specifies the configuration file location, MySQL configuration file under Linux is called MY.CNF, we do not specify in the first command,
In the ETC directory only to find a my.cnf.rpmsave, also can run normally, I do not know how the matter ... It should be set up in the service script, okay?
And then to revise this blog


After success, change the owner of data to MySQL:

chown -R mysql:mysql Data

7. Registration Service

Registering the MySQL service in, as far as my current level of understanding is actually to move the startup script a position:

CP Support-files/mysql.server/etc/init.d/mysql

Register for Boot:

See if you added success:

8. Start the MySQL service:

Service MySQL Start

9. Use

To view the root user's current password for MySQL:

Cat /root/.mysql_secret

Log in to MySQL:

Mysql-uroot-p

Then enter the password you found in the previous step.

Change Password to QW12QW12:

1, change password with mysql command: Alter user'Root'@'localhost'identified by ' Qw12qw12 ';2, update mysql.user set authentication_string=password ('Qw12qw12') Where user='Root'and host='localhost';3, write: Flush privileges;

Complete.

The process of stepping on the pit to see a lot of content, not a fully in line with the current operation, only in this, is willing to help

The content of the pure I hand dozen, also through my practice, welcome to correct.

Centos 7 Install and uninstall Mysql5.7 (compact package)

Related Article

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.