CentOS7 How to install MySQL database centOS7 install MySQL database tutorial

Source: Internet
Author: User
Tags mysql database

1, first detect whether the system with the original version of the MySQL installation package, if there is to uninstall first delete, otherwise can not be successfully installed and started;

# rpm-qa|grep MySQL to see what packages are installed, if skip directly, indicating that there is no installation package, memory can be directly into the 2nd, 3
# yum Remove MySQL mysql-server mysql-libs compat-mysql51 Note This code, uninstall is not clean
# Rm-rf/var/lib/mysql
# RM/ETC/MY.CNF
# Rpm-qa|grep MySQL to see if you have deleted, did not delete, then delete, but to delete

Such as:

You can see that there are two installation packages

mysql-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
mysql-client-5.6.19-1.linux_glibc2.5.x86_64.rpm

Delete these two services (remove suffix)

# rpm–e mysql-client-5.6.19-1.linux_glibc2.5.x86_64 # rpm-e mysql-server-5.6.19-1.linux_glibc2.5.x86_64

To view the remaining directories:

# Whereis MySQL

And then delete the MySQL directory:

# Rm–rf/usr/lib64/mysql

2, download the MySQL repo source

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

3. Install MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM Package

# RPM-IVH mysql-community-release-el7-5.noarch.rpm

4, install MySQL

#yum Install Mysql-community-server

5. Restart MySQL service after successful installation

#service mysqld Restart

6. Reset Password

# mysql-uroot Mysql>use MySQL; mysql> Update user Set password = password (' 123456 ') where user = ' root '; mysql> flush Privileges;              That's a success. Mysql> exit;

Want to know the password in the end right? You can verify that you are exiting to log in again;

# Mysql-uroot-p here must add-p, he will remind you to enter password:

You only need to enter the password you have just set to enter, if you do not go, then you perform 6 and then set it again; I set the password to 123456, after each login to the MySQL root login is: # mysql-uroot-p

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.