Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Specific method of installing MySQL in centos7 system

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly gives you a brief introduction to the specific methods of installing MySQL on the centos7 system. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on the specific methods of installing MySQL in the centos7 system can bring you some practical help.

This example is the centos7 version: mysql is mysql-5.5.56.tar.gz

1. Uninstall the existing database on the CVM

Rpm-qa | grep mariadb # query whether the default mysql,centos7 version database is mariadb

Rpm-e-nodeps # uninstall if any

two。 Download the source package

Https://www.mysql.com/ # download address

Download and upload to the CVM

3. Install dependency 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. Decompress, compile and install the source code

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

Cd / usr/local/mysql-5.5.56/

Compile: 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. Authorize the database directory

Chmown-R mysql:mysql / usr/local/mysql

7. Establish a configuration file

Copy the support-files folder in the mysql source directory to / etc/mycnf

Cp support-files/my-medium.cnf / etc/my.cnf

8. Initialize the database

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

L/mysql/data/

9. Set environment variabl

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

10. Add system services

Cp-P support-files/mysql.server / etc/rc.d/init.d/mysqld

Chmod axix / 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.015 * LISTEN 14245/mysqld

twelve。 Access 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) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

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

Affiliates. Other names may be trademarks of their respective

Owners.

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

Mysql >

Centos7 system installation MySQL specific methods to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report