Centos7 How to install MySQL--detailed installation

Source: Internet
Author: User

This example is CENTOS7 version: MySQL is mysql-5.5.56.tar.gz

1. Uninstalling the existing database on the server

Rpm-qa | grep mariadb # # #查询本机有没有默认的mysql, CENTOS7 version database is MARIADB

Rpm-e--nodeps # # #有的话卸载掉

2. Download the source package

https://www.mysql.com/  ###

Download it and upload it to the server.

3. Installing dependent Packages

Yum-y install make gcc-c++ cmake bison-devel ncurses-devel

4. Create a user

Groupadd MySQL

Useradd-m-s/sbin/nologin mysql-g MySQL

5. Unzip, compile and install the source code

Tar zvxf mysql-5.5.56.tar.gz-c/usr/local/

cd/usr/local/mysql-5.5.56/

Compiling: Cmake-dcmake_install_prefix=/usr/local/mysql-dsysconfdir=/etc-ddefault_charset=utf8-ddefault_coll

Ation=utf8_general_ci-dwith_extra_charsets=all

Installation: Make

Make install

6. Authorization of the database directory

Chmown-r Mysql:mysql/usr/local/mysql

7. Create a configuration file

Copy the Support-files folder from the MySQL source directory to/etc/mycnf

CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF

8. Initializing the database

/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/loca

l/mysql/data/

9. Setting Environment variables

Export path= $PATH:/usr/local/mysql/bin

10. Adding system Services

Cp-p Support-files/mysql.server/etc/rc.d/init.d/mysqld

chmod a+x/etc/rc.d/init.d/mysqld

Chkconfig--add mysqld

11. Start the database:

Service mysqld Start

Service MYSQLD Status

NETSTAT-ANPT | grep mysqld

TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 14245/mysqld

12. Accessing the database (no password by default)

Mysql-u root-p

Enter Password:

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 3

Server Version:5.5.56-log Source Distribution

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

This document only writes to how to install the database, and the next time it writes how to use the database

Hope My Documents can help more people! --Hing


This article is from the "Hing" blog, make sure to keep this source http://jiaxinwang.blog.51cto.com/12273793/1935065

Centos7 How to install MySQL--detailed installation

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.